diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-02-08 16:26:46 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2023-09-27 10:16:25 +0200 |
commit | 6766df630c02f33c8fd24922af131ef3da82fbb3 (patch) | |
tree | 403f9d8804e2708094162b218081f4fa25417e4a /gcc | |
parent | bb15f0c3762b5e0ff5615a4fec091c6e66590041 (diff) | |
download | gcc-6766df630c02f33c8fd24922af131ef3da82fbb3.zip gcc-6766df630c02f33c8fd24922af131ef3da82fbb3.tar.gz gcc-6766df630c02f33c8fd24922af131ef3da82fbb3.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch3.adb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index da4d52a..3d546a8 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); |