[Bug c++/17581] Long long arithmetic fails inside a switch/case statement when compiled with -O2
alottem at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 21 12:22:00 GMT 2004
------- Additional Comments From alottem at yahoo dot com 2004-09-21 12:22 -------
The test case was further minimized to the following:
------------------------ cut here ------------------------
#include <stdio.h>
int
f(long unsigned x1)
{
unsigned long long ctl_bitvec = 0;
switch(x1) {
case 21:
ctl_bitvec |= 1;
ctl_bitvec |= 2;
ctl_bitvec |= 8;
break;
default:
break;
}
printf("%llx\n", ctl_bitvec);
return ctl_bitvec;
}
main() {
f(21);
}
------------------------ cut here ------------------------
And running:
% make && make run
/usr/intel/pkgs/gcc/3.4/bin/g++ -O2 test.c -o test_o2
/usr/intel/pkgs/gcc/3.4/bin/g++ -O test.c -o test_o
./test_o2
8
./test_o
b
It does not fail with gcc 3.3.2. unfortunately, I was not able to test with
versions later than 3.4.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17581
More information about the Gcc-bugs
mailing list