No warning when breaking strict-aliasing rules despite -Wstrict-aliasing

2004-11-09 Thread Anders Torger
code below does violate them (by casting an uint64 array to an uint32 array), although GCC does not think so. gcc 2.95 generates correct code. gcc 3.2.3 fails gcc 3.3.5 fails gcc 3.4.2 fails /Anders Torger */ #include unsigned long hash(void *key) { unsigned long long u[1

Re: -O2 bug in gcc 3.2, 3.3 and 3.4 with 64 bit integers on x86

2004-11-09 Thread Anders Torger
dered errors)? I think the current behaviour is a bit dangerous, since the code works in previous versions of GCC, and with other compilers, and that the current compiler does accept the code although it knows that it will probably do wrong. /Anders Torger On Tuesday 09 November 2004 17.26, An

Re: -O2 bug in gcc 3.2, 3.3 and 3.4 with 64 bit integers on x86

2004-11-09 Thread Anders Torger
Compiler makes same mistake, the only difference is the warning at compile time, which can be avoided with this casting trick: return ((unsigned long *)(void *)&ull)[0] ^ ((unsigned long *)(void *)&ull)[1]; /Anders On Tuesday 09 November 2004 16.56, you wrote: > Anders Tor

-O2 bug in gcc 3.2, 3.3 and 3.4 with 64 bit integers on x86

2004-11-09 Thread Anders Torger
from package system from unstable as of 9 Nov 2004. gcc -O2 -S test.c no messages are generated at compilation. gcc 2.95 generates correct code. gcc 3.2.3 fails gcc 3.3.5 fails gcc 3.4.2 fails /Anders Torger */ #include unsigned long hash(void *key) { unsigned long long