From 9e8102b350742f09e8c122f3d3ee3f9f2ce4abd4 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 24 May 2020 15:23:42 +0200 Subject: [PATCH] [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. --- gcc/ada/exp_ch4.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 2.30.2