aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-09-07 16:44:36 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-09-15 15:01:30 +0200
commitb96446e0d0afd0d817f6206efabb1deed4e1ed8e (patch)
tree2c53d5b90f46d27c89f28f235713f5e6a67f23b0
parent2578936b341585230d8554bb9c822c3d6f46f6ad (diff)
downloadgcc-b96446e0d0afd0d817f6206efabb1deed4e1ed8e.zip
gcc-b96446e0d0afd0d817f6206efabb1deed4e1ed8e.tar.gz
gcc-b96446e0d0afd0d817f6206efabb1deed4e1ed8e.tar.bz2
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.
-rw-r--r--gcc/ada/inline.adb1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index db8b416..4e8d0f1 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));