------- Comment #67 from baldrick at free dot fr  2008-03-30 17:03 -------
Subject: Re:  VRP fails to eliminate range checks in Ada code

> Try first to compile it. :-)

I did!  I didn't notice the compile error
after the -gnatG output.  Indeed, when fixed
thusly

procedure Overflow (X : Positive) is
   A : array (Positive) of Integer;
   pragma Import (Ada, A);
begin
   A (X) := X;
end;

then you do get a check:

with interfaces;

procedure overflow (x : positive) is
   a : array (1 .. 16#7FFF_FFFF#) of integer;
   pragma import (ada, a);
begin
   [constraint_error when not (interfaces__unsigned_32!(x) >= 1 and then
     interfaces__unsigned_32!(x) <= 16#7FFF_FFFF#) "invalid data"]
   a (x) := x;
   return;
end overflow;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911

Reply via email to