summaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-09 12:56:35 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-09 12:56:35 +0000
commit06ad58133a228367bdb349b8a4ae05b99f6fe7a1 (patch)
treec9396acfdb481bb1f0b392c30aabf121b6eb489f /gcc/ada/checks.adb
parent95d1d545e83f24563e6ada37773205cbcf441b73 (diff)
downloadgcc-06ad58133a228367bdb349b8a4ae05b99f6fe7a1.tar.gz
2009-04-09 Robert Dewar <dewar@adacore.com>
* checks.adb: (Insert_Valid_Check): Avoid unnecessary generation of junk declaration when no invalid values exist, Avoid duplicate read of atomic variable. * cstand.adb (Build_Signed_Integer_Type): Set Is_Known_Valid (Standard_Unsigned): Set Is_Known_Valid * sem_ch3.adb (Analyze_Subtype_Declaration): Copy Is_Known_Valid on subtype declaration if no constraint. (Set_Modular_Size): Set Is_Known_Valid if appropriate (Build_Derived_Numeric_Type): Copy Is_Known_Valid if no constraint git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145836 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index da6ca2e68c8..45462db72b5 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -5125,10 +5125,12 @@ package body Checks is
Exp : Node_Id;
begin
- -- Do not insert if checks off, or if not checking validity
+ -- Do not insert if checks off, or if not checking validity or
+ -- if expression is known to be valid
if not Validity_Checks_On
or else Range_Or_Validity_Checks_Suppressed (Expr)
+ or else Expr_Known_Valid (Expr)
then
return;
end if;
@@ -5152,6 +5154,14 @@ package body Checks is
begin
Set_Do_Range_Check (Exp, False);
+ -- Force evaluation to avoid multiple reads for atomic/volatile
+
+ if Is_Entity_Name (Exp)
+ and then Is_Volatile (Entity (Exp))
+ then
+ Force_Evaluation (Exp, Name_Req => True);
+ end if;
+
-- Insert the validity check. Note that we do this with validity
-- checks turned off, to avoid recursion, we do not want validity
-- checks on the validity checking code itself!