Commit 3b641023 by Ed Schonberg Committed by Arnaud Charlet

exp_attr.adb (Mod): Evaluate condition expression with checks off, to prevent spurious warnings.

2005-07-04  Ed Schonberg  <schonberg@adacore.com>

	* exp_attr.adb (Mod): Evaluate condition expression with checks off,
	to prevent spurious warnings.

From-SVN: r101577
parent d9e0a587
...@@ -2372,7 +2372,7 @@ package body Exp_Attr is ...@@ -2372,7 +2372,7 @@ package body Exp_Attr is
Right_Opnd => Make_Integer_Literal (Loc, Modv)))); Right_Opnd => Make_Integer_Literal (Loc, Modv))));
-- Here we know that the modulus is larger than type'Last of the -- 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 -- a) The integer value is non-negative. In this case, it is
-- returned as the result (since it is less than the modulus). -- returned as the result (since it is less than the modulus).
...@@ -2393,6 +2393,10 @@ package body Exp_Attr is ...@@ -2393,6 +2393,10 @@ package body Exp_Attr is
-- Furthermore, (-value - 1) can be expressed as -(value + 1) -- Furthermore, (-value - 1) can be expressed as -(value + 1)
-- which we can compute using the integer base type. -- 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 else
Rewrite (N, Rewrite (N,
Make_Conditional_Expression (Loc, Make_Conditional_Expression (Loc,
...@@ -2420,7 +2424,7 @@ package body Exp_Attr is ...@@ -2420,7 +2424,7 @@ package body Exp_Attr is
end if; end if;
Analyze_And_Resolve (N, Btyp); Analyze_And_Resolve (N, Btyp, All_Checks);
end Mod_Case; end Mod_Case;
----------- -----------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment