[Bug middle-end/28042] optimizer (-O2) changes the semantics of my programs
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jun 16 10:25:00 GMT 2006
------- 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
More information about the Gcc-bugs
mailing list