From patchwork Mon May 22 08:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 97202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1305902vqo; Mon, 22 May 2023 02:05:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MF79/zFTZ9SQacNI08/LKVvTnRuN2+LbxK477S0LgCEF9D62DlvtNS5ikrMLoYrYEHQYB X-Received: by 2002:a17:907:98e:b0:967:b02c:b06a with SMTP id bf14-20020a170907098e00b00967b02cb06amr9286338ejc.27.1684746340448; Mon, 22 May 2023 02:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684746340; cv=none; d=google.com; s=arc-20160816; b=hb7ZlnValRkiljoj+jXFw8qlhkfxulueeeEqfTacYV+cOvSO+j0NNUH8oDXojdqT29 Gba+BsH5QrCb5twqI0NFz2JRu6k4RYCW6LJXeVexb0v3DKSeLseHqAAJDOTbzKjBAvaq 4u8RVfLEiLHq/zBGhfY/Y7+M2oNtho+k54bvn7xpk2MlOnqSXmDMZxM5SI06c66YYZj4 2NlATLwa5GrbZBvmWlvE8JPpZE2BzxL9oMEqzYqlOJ3X5+TGMtOAaJi8iiIKERcvWJ8f K41lOZpcxhihCoZNWtB7vfF55CYYagwkRIYRXUgqAcPvSenZi4FB38rg3+XVa7/HyiPO qnEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=T0msC5pCXRKJOMF1TbbPyIuzlRUu2+kWE5Ac963LBRQ=; b=zumT6zHfqLYXSLyOqcV+iDrqB+ZYufIwvyE2xjFl1gwYl6s/3rGAToLJnjc7oLAzcO TiS2OYOqZdWIoY+m+0KQCNppXaRnDGyxv5VqtDjLuBjnBwjT6qF6R1GztbGb7G57SgHg CORHA36sPtonmvOIX7aBGDcD4l4k+GQegQv/zlY2HHM60pjYJd7K6akwiDFCdX2WfKD9 2/rljcoSjA89VHIwzuOyKaMuACHwq3OXEVagI4XtVCkWvVb1ujoPOFb4FbY1N8wPrnok eXyUu6/KFlYLjuhRgIP+qE4n+E7AV752yoPKksOCYLDDzBkRFXe6vx7zWjbEmHO1Y5qh TaUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EKCT5jkE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ga25-20020a170906b85900b00965a18ec46bsi2856924ejb.625.2023.05.22.02.05.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 02:05:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EKCT5jkE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCBD1395C013 for ; Mon, 22 May 2023 08:57:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCBD1395C013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684745854; bh=T0msC5pCXRKJOMF1TbbPyIuzlRUu2+kWE5Ac963LBRQ=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=EKCT5jkER5HWYJyXGlxOx2X1Y7hFiRuomB1RchQ/avXyLJ8Er1cFsYV12DwpdW7Lm aFWSQ5BpOnCeROpjZbpiPIqk/0IQoIvbgC41T82XuYx+9AugUOfyC8Qn4HJN9t1BmV POA3L5UjMx4EGHVO28AnVzO721h6Bz4fYrlT1mYU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id D11F93858410 for ; Mon, 22 May 2023 08:51:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D11F93858410 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f475366514so38739435e9.2 for ; Mon, 22 May 2023 01:51:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684745464; x=1687337464; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T0msC5pCXRKJOMF1TbbPyIuzlRUu2+kWE5Ac963LBRQ=; b=AYqvvdMxesf9rRl8sa3x+3fJ5GgQilz65mXX3z7JRniq+ch23Gzh5N1hS1Ol5IAt96 Tj+TRChoL/M8kxSZ3MTxP/0uj4CFsi9snmHT1vU2gXSUKIXwbkVWjN/Zqz+m4AxSLvXj UPu3ixmhbbME/h9AAjN+lVyl6qdFzWwcyxS/+ZLdEV1cCdBv6NvFhEFDWajrLCY65Xf/ O/puJlXX7uGnOYamyfCXcEA8cgFnln3PWG/jAZ8v1H6yW9tSFgX8LP565YvgbSS2Qbiu QQhpI2cGcXqS5uqlovYdyIe7y+XFpYIB3qrLt0dVn/8H4juytAF9JR6PYWR3CL75Gecr oCHQ== X-Gm-Message-State: AC+VfDwb9/M38QGlK8cVE9OYXmlynqODidp6OhSsvkEELO7b4Fny8pBc RY3dPn/ZUKiy3TYIwC7p3ti+63U7/arD7wKfQtqGsw== X-Received: by 2002:a7b:c8cd:0:b0:3f4:231e:7a99 with SMTP id f13-20020a7bc8cd000000b003f4231e7a99mr6770511wml.3.1684745464698; Mon, 22 May 2023 01:51:04 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id u10-20020a5d514a000000b003079693eff2sm6988011wrt.41.2023.05.22.01.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:51:04 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix spurious freezing error on nonabstract null extension Date: Mon, 22 May 2023 10:51:03 +0200 Message-Id: <20230522085103.1726874-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766584578598002762?= X-GMAIL-MSGID: =?utf-8?q?1766584578598002762?= From: Eric Botcazou This prevents the wrapper function created for each nonoverridden inherited function with a controlling result of nonabstract null extensions of tagged types from causing premature freezing of types referenced in its profile. gcc/ada/ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Create the body as the expanded body of an expression function. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch3.adb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index b8ab549c0fc..3a023092532 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -11109,9 +11109,10 @@ package body Exp_Ch3 is Null_Record_Present => True); -- GNATprove will use expression of an expression function as an - -- implicit postcondition. GNAT will not benefit from expression - -- function (and would struggle if we add an expression function - -- to freezing actions). + -- implicit postcondition. GNAT will also benefit from expression + -- function to avoid premature freezing, but would struggle if we + -- added an expression function to freezing actions, so we create + -- the expanded form directly. if GNATprove_Mode then Func_Body := @@ -11130,6 +11131,7 @@ package body Exp_Ch3 is Statements => New_List ( Make_Simple_Return_Statement (Loc, Expression => Ext_Aggr)))); + Set_Was_Expression_Function (Func_Body); end if; Append_To (Body_List, Func_Body);