summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_attr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-04 13:27:32 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-04 13:27:32 +0000
commit9eb397d874bd4263ab9a5af38a25764fe8c35cc6 (patch)
tree101f3dee509d9d4f866608dbae64b745e938791a /gcc/ada/exp_attr.adb
parent1735f9114114689b4d05cacbcdf7d11556728036 (diff)
downloadgcc-9eb397d874bd4263ab9a5af38a25764fe8c35cc6.tar.gz
2005-07-04 Ed Schonberg <schonberg@adacore.com>
* exp_attr.adb (Mod): Evaluate condition expression with checks off, to prevent spurious warnings. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101577 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_attr.adb')
-rw-r--r--gcc/ada/exp_attr.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index e80a15db823..0c43d595207 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -2372,7 +2372,7 @@ package body Exp_Attr is
Right_Opnd => Make_Integer_Literal (Loc, Modv))));
-- Here we know that the modulus is larger than type'Last of the
- -- integer type. There are three possible cases to consider:
+ -- integer type. There are two cases to consider:
-- a) The integer value is non-negative. In this case, it is
-- returned as the result (since it is less than the modulus).
@@ -2393,6 +2393,10 @@ package body Exp_Attr is
-- Furthermore, (-value - 1) can be expressed as -(value + 1)
-- which we can compute using the integer base type.
+ -- Once this is done we analyze the conditional expression without
+ -- range checks, because we know everything is in range, and we
+ -- want to prevent spurious warnings on either branch.
+
else
Rewrite (N,
Make_Conditional_Expression (Loc,
@@ -2420,7 +2424,7 @@ package body Exp_Attr is
end if;
- Analyze_And_Resolve (N, Btyp);
+ Analyze_And_Resolve (N, Btyp, All_Checks);
end Mod_Case;
-----------