diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b10768b354dd..1f59c88303b1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-12-11 Ed Schonberg + + * sem_ch3.adb (Analyze_Object_Declaration): Apply + Dynamic_Predicate check to an object of an array type + initialized with an aggregate. + 2018-12-11 Hristian Kirtchev * freeze.adb (Add_To_Result): Move the ignored Ghost-specific diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 5195f8a267b3..bbae46858f22 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4454,11 +4454,16 @@ package body Sem_Ch3 is -- default initialization when we have at least one case of an explicit -- default initial value and then this is not an internal declaration -- whose initialization comes later (as for an aggregate expansion). + -- If expression is an aggregate it may be expanded into assignments + -- and the declaration itself is marked with No_Initialization, but + -- the predicate still applies. if not Suppress_Assignment_Checks (N) and then Present (Predicate_Function (T)) and then not Predicates_Ignored (T) - and then not No_Initialization (N) + and then + (not No_Initialization (N) + or else (Present (E) and then Nkind (E) = N_Aggregate)) and then (Present (E) or else