------- Comment #6 from rguenth at gcc dot gnu dot org  2006-06-16 10:24 -------
So, we fold

int foo(int i)
{
  return i>=0 && (i>=-1073741824 && i<1073741824);
}

into return i>=0.  Or more precise, we fold

int foo(int i)
{
  return i>=0 && i - -1073741824 >= 0;
}

to return i>=0 (4.2 does this as well),
as we fold
  (i>=-1073741824 && i<1073741824)
to 
  i - -1073741824 >= 0  (wrong, this overflows for i == 1073741824)
first;  4.2 folds that to
  (int)((unsigned)i - 0c0000000) >= 0.   (ok)

(the overflow flag on 0c0000000 is still wrong)


-- 


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

Reply via email to