This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17581] Long long arithmetic fails inside a switch/case statement when compiled with -O2
- From: "alottem at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Sep 2004 12:22:51 -0000
- Subject: [Bug c++/17581] Long long arithmetic fails inside a switch/case statement when compiled with -O2
- References: <20040921084529.17581.alottem@yahoo.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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