diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-02-08 16:26:46 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-22 10:44:10 +0200 |
commit | ea97b4dbee9eaf4c88228ded8b7c56351a2b1659 (patch) | |
tree | 90235a3fc197a9d3f73c5f91f17a073414e8601f | |
parent | 55f24dde7b5c87d9ab00e3b268e2080b9bdd1cc9 (diff) | |
download | gcc-ea97b4dbee9eaf4c88228ded8b7c56351a2b1659.zip gcc-ea97b4dbee9eaf4c88228ded8b7c56351a2b1659.tar.gz gcc-ea97b4dbee9eaf4c88228ded8b7c56351a2b1659.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.
-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 b8ab549..3a02309 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); |