]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix wrong optimization of extended return for discriminated record type
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 7 Sep 2023 14:44:36 +0000 (16:44 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 27 Sep 2023 08:16:30 +0000 (10:16 +0200)
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.

gcc/ada/inline.adb

index c3911cf70e862e02c63a7592946226d918a08cc3..598668b0e550aadd9095695949a310f709dcd640 100644 (file)
@@ -4105,6 +4105,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));