From: Eric Botcazou Date: Thu, 7 Sep 2023 14:44:36 +0000 (+0200) Subject: ada: Fix wrong optimization of extended return for discriminated record type X-Git-Tag: basepoints/gcc-15~6108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b96446e0d0afd0d817f6206efabb1deed4e1ed8e;p=thirdparty%2Fgcc.git ada: Fix wrong optimization of extended return for discriminated record type This happens when the discriminants of the record type have default values. gcc/ada/ChangeLog: * inline.adb (Expand_Inlined_Call): In the case of a function call that returns an unconstrained type and initializes an object, set the No_Initialization flag on the new declaration of the object. --- diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index db8b4164e877..4e8d0f1bb749 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -4157,6 +4157,7 @@ package body Inline is Object_Definition => New_Copy_Tree (Object_Definition (Parent (Targ1)))); Replace_Formals (Decl); + Set_No_Initialization (Decl); Rewrite (Parent (N), Decl); Analyze (Parent (N));