Bug#288739: gcc optimization bug
Package: gcc
Version: 2.95.4 20011002
following function compiled w/ gcc -O
int foo(unsigned int a)
{
if(a * sizeof(int) / sizeof(int) != a)
return -1;
return 0;
}
results in:
00000000 <foo__FUi>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 31 c0 xor %eax,%eax
5: c9 leave
6: c3 ret
7: 90 nop
gcc optimizes the arithmetic overflow check away!
Debian GNU/Linux 3.0
vanilla kernel 2.2.26
libc6 Version: 2.2.5-11.5
Regards,
Marco Fabbricatore
--- "Smith & Wesson: The original point and click interface." ---
Reply to: