]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Disable Equivalent_Array_Aggregate optimization if predicates involved
authorSteve Baird <baird@adacore.com>
Sat, 9 Mar 2024 00:17:41 +0000 (16:17 -0800)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 17 May 2024 08:21:04 +0000 (10:21 +0200)
In most paths, the function Build_Equivalent_Record_Aggregate was already
testing Has_Predicates for a given component type and conditionally returning
an Empty result. This is also needed in the case of a scalar component type.
Without it, we can build corrupt trees that fail use-before-definition
detection checks in gigi.

gcc/ada/

* exp_ch3.adb (Build_Equivalent_Record_Aggregate): Add
Has_Predicates test for a scalar component to match what is
already done for other kinds of components.

gcc/ada/exp_ch3.adb

index 5764b22b80027ae106b682a2cf3464aef171bfb7..f6314dff285feeebdbaec1205778a3c62b212b89 100644 (file)
@@ -1950,6 +1950,7 @@ package body Exp_Ch3 is
               or else not Compile_Time_Known_Value (Type_Low_Bound (Comp_Type))
               or else not
                 Compile_Time_Known_Value (Type_High_Bound (Comp_Type))
+              or else Has_Predicates (Etype (Comp))
             then
                Initialization_Warning (T);
                return Empty;