From: Eric Botcazou Date: Sun, 24 May 2020 13:23:42 +0000 (+0200) Subject: [Ada] Do not apply constraint checks on allocator with No_Initialization X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e8102b350742f09e8c122f3d3ee3f9f2ce4abd4;p=gcc.git [Ada] Do not apply constraint checks on allocator with No_Initialization gcc/ada/ * exp_ch4.adb (Expand_N_Allocator): In the subtype mark case, do not apply constraint checks if the No_Initialization flag is set. --- diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index b40864fb5b4..cd710754617 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -4847,10 +4847,11 @@ package body Exp_Ch4 is Temp_Type : Entity_Id; begin - -- Apply constraint checks against designated subtype (RM 4.8(10/2)). + -- Apply constraint checks against designated subtype (RM 4.8(10/2)) + -- but ignore the expression if the No_Initialization flag is set. -- Discriminant checks will be generated by the expansion below. - if Is_Array_Type (Dtyp) then + if Is_Array_Type (Dtyp) and then not No_Initialization (N) then Apply_Constraint_Check (Expression (N), Dtyp, No_Sliding => True); Apply_Predicate_Check (Expression (N), Dtyp);