From 1115dd7ed7f7aec9c532b74ae01390e0fc0f57cf Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Tue, 6 Nov 2012 10:47:21 +0000 Subject: [PATCH] sem_res.adb (Preanalyze_And_Resolve): In Alfa mode do not disable checks... 2012-11-06 Ed Schonberg * sem_res.adb (Preanalyze_And_Resolve): In Alfa mode do not disable checks, so that flags can be properly set on expressions that are not further expanded. From-SVN: r193231 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/sem_res.adb | 26 ++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d2ad541..cfa05a2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2012-11-06 Ed Schonberg + + * sem_res.adb (Preanalyze_And_Resolve): In Alfa mode do not + disable checks, so that flags can be properly set on expressions + that are not further expanded. + 2012-11-06 Robert Dewar * exp_attr.adb, sem_attr.adb: Minor reformatting. diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index defe37f..847dd30 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -1379,6 +1379,13 @@ package body Sem_Res is if Nkind (Name (N)) = N_Expanded_Name then Pack := Entity (Prefix (Name (N))); + -- If this is a package renaming, get renamed entity, which will be + -- the scope of the operands if operaton is type-correct. + + if Present (Renamed_Entity (Pack)) then + Pack := Renamed_Entity (Pack); + end if; + -- If the entity being called is defined in the given package, it is -- a renaming of a predefined operator, and known to be legal. @@ -1683,11 +1690,22 @@ package body Sem_Res is Full_Analysis := False; Expander_Mode_Save_And_Set (False); - -- We suppress all checks for this analysis, since the checks will - -- be applied properly, and in the right location, when the default - -- expression is reanalyzed and reexpanded later on. + -- We suppress all checks for this analysis, except in Alfa mode. + -- Otherwise the checks are applied properly, and in the proper + -- location, when the default expressions are reanalyzed and reexpanded + -- later on. + + -- Alfa mode suppresses all expansion but requires the setting of + -- checking flags (DIvision_Check and others) in particular for Ada 2012 + -- constructs such as quantified expressions, that are expanded in two + -- separate steps. - Analyze_And_Resolve (N, T, Suppress => All_Checks); + if Alfa_Mode then + Analyze_And_Resolve (N, T); + + else + Analyze_And_Resolve (N, T, Suppress => All_Checks); + end if; Expander_Mode_Restore; Full_Analysis := Save_Full_Analysis; -- 2.7.4