From: Ghjuvan Lacambre Date: Thu, 12 Mar 2020 13:12:53 +0000 (+0100) Subject: [Ada] Generate predicate checks for on assignments in records X-Git-Tag: basepoints/gcc-12~7056 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6593c082b9aae7292714b20ce8f26f76e57d2221;p=thirdparty%2Fgcc.git [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. --- diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 3bc1f607f9af..f412debb65ce 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