From: Eric Botcazou Date: Wed, 8 Feb 2023 15:26:46 +0000 (+0100) Subject: ada: Fix spurious freezing error on nonabstract null extension X-Git-Tag: basepoints/gcc-15~9082 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea97b4dbee9eaf4c88228ded8b7c56351a2b1659;p=thirdparty%2Fgcc.git 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 --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index b8ab549c0fc2..3a0230925325 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);