This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Compiler bug.... (resent)
- To: bug-gcc at gnu dot org
- Subject: Compiler bug.... (resent)
- From: dirk dot derycke at icos dot be
- Date: Fri, 29 Oct 1999 13:54:51 +0200
Hi,
I have the following strange error that occurs when compiling WITHOUT
optimizations
const unsigned short shift = 32;
unsigned int res;
res = 1 << shift;
normally this fragment should cause an overflow and res should become zero
but
without optimizations
res = 1;
the 1 bit seems to roll over and enters in the least significant bit
with optimizations
res = 0
(optimizer determines the CORRECT value at compile time)
Compiler version: 2.95.2
Platform : i686-pc-linux-gnu
I added the problem program with its makefile to this mail
regards,
Dirk De Rycke
dirk.derycke@icos.be
(See attached file: Makefile)(See attached file: shift.c)
Makefile
shift.c