[Bug c/26824] optimisation bug with -0x80000000
simonmar at microsoft dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 23 15:10:00 GMT 2006
------- Comment #5 from simonmar at microsoft dot com 2006-03-23 15:10 -------
I see your point, but I still think there's a bug. Let me change the code
slightly:
#include <stdlib.h>
#include <stdio.h>
void f(int x) {
long y;
if (x < 0) {
y = -x;
if (y > 0) {
printf("%d\n",y);
}
}
}
int main() {
f(-0x80000000);
exit(0);
}
$ gcc -O2 foo.c
$ ./a.out
-2147483648
so, we're in the y > 0 branch, but y is clearly < 0.
--
simonmar at microsoft dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Component|middle-end |c
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26824
More information about the Gcc-bugs
mailing list