From 6593c082b9aae7292714b20ce8f26f76e57d2221 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Thu, 12 Mar 2020 14:12:53 +0100 Subject: [PATCH] [Ada] Generate predicate checks for on assignments in records 2020-06-11 Ghjuvan Lacambre gcc/ada/ * exp_ch3.adb (Build_Assignment): Generate predicate check if subtype mark has predicate. --- gcc/ada/exp_ch3.adb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 3bc1f607f9a..f412debb65c 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -1998,6 +1998,20 @@ package body Exp_Ch3 is Append (Make_Predicate_Check (Typ, Exp), Res); end if; + if Nkind (Exp) = N_Allocator + and then Nkind (Expression (Exp)) = N_Qualified_Expression + then + declare + Subtype_Entity : constant Entity_Id + := Entity (Subtype_Mark (Expression (Exp))); + begin + if Has_Predicates (Subtype_Entity) then + Append (Make_Predicate_Check + (Subtype_Entity, Expression (Expression (Exp))), Res); + end if; + end; + end if; + return Res; exception -- 2.30.2