aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-05-24 15:23:42 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:55 -0400
commit9e8102b350742f09e8c122f3d3ee3f9f2ce4abd4 (patch)
treee98db1487fdfe0bdf1b8009a52da5ce01147da91 /gcc/ada/exp_ch4.adb
parentd387808d8bd4e6eda08dd5f1661c1c70a6c9a1b2 (diff)
downloadgcc-9e8102b350742f09e8c122f3d3ee3f9f2ce4abd4.zip
gcc-9e8102b350742f09e8c122f3d3ee3f9f2ce4abd4.tar.gz
gcc-9e8102b350742f09e8c122f3d3ee3f9f2ce4abd4.tar.bz2
[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.
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index b40864f..cd71075 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);