This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Mar 2008 15:09:06 -0000
- Subject: [Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code
- References: <bug-30911-13647@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #60 from rguenth at gcc dot gnu dot org 2008-03-30 15:09 -------
function overflow (x : positive) return integer is
y : positive;
a : static array (1 .. 16#7FFF_FFFF#) of integer;
pragma import (ada, a);
begin
R4b : constant long_long_integer := long_long_integer?(a (x)) +
long_long_integer?(a (y));
[constraint_error when
not (R4b in -16#8000_0000# .. 16#7FFF_FFFF#)
"overflow check failed"]
return integer(integer?(R4b));
end overflow;
so it checks the result of the addition, but not that x or y are within
bounds before accessing the array.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911