------- 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

Reply via email to