public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7856] ada: Fix spurious freezing error on nonabstract null extension
@ 2023-09-27  8:24 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27  8:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6766df630c02f33c8fd24922af131ef3da82fbb3

commit r13-7856-g6766df630c02f33c8fd24922af131ef3da82fbb3
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Wed Feb 8 16:26:46 2023 +0100

    ada: Fix spurious freezing error on nonabstract null extension
    
    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.

Diff:
---
 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 da4d52a3d16..3d546a8cb28 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-27  8:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27  8:24 [gcc r13-7856] ada: Fix spurious freezing error on nonabstract null extension Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).