From a51368fad9985f84e3215cf9897f389698fbbba5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 23 Jan 2017 13:04:16 +0100 Subject: [multiple changes] 2017-01-23 Pascal Obry * s-taprop-mingw.adb (Enter_Task): Initialize the Thread handle which is needed when a foreign thread call a Win32 API using a thread handle like GetThreadTimes() for example. 2017-01-23 Hristian Kirtchev * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not allow an 'Address clause to be specified on a prefix of a class-wide type. 2017-01-23 Hristian Kirtchev * checks.adb (Insert_Valid_Check): Ensure that the prefix of attribute 'Valid is a renaming of the original expression when the expression denotes a name. For all other kinds of expression, use a constant to capture the value. * exp_util.adb (Is_Name_Reference): Moved to Sem_Util. * sem_util.ads, sem_util.adb (Is_Name_Reference): Moved from Exp_Util. 2017-01-23 Justin Squirek * sem_eval.adb (Eval_Integer_Literal): Add special case to avoid optimizing out check if the literal appears in an if-expression. From-SVN: r244792 --- gcc/ada/sem_eval.adb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/ada/sem_eval.adb') diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 0d135cf..6e56e1d 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -2682,9 +2682,12 @@ package body Sem_Eval is -- If the literal appears in a non-expression context, then it is -- certainly appearing in a non-static context, so check it. This is -- actually a redundant check, since Check_Non_Static_Context would - -- check it, but it seems worth while avoiding the call. + -- check it, but it seems worth while to optimize out the call. - if Nkind (Parent (N)) not in N_Subexpr + -- An exception is made for a literal in an if or case expression + + if (Nkind_In (Parent (N), N_If_Expression, N_Case_Expression_Alternative) + or else Nkind (Parent (N)) not in N_Subexpr) and then not In_Any_Integer_Context then Check_Non_Static_Context (N); -- cgit v1.1