------- Comment #4 from ebotcazou at gcc dot gnu dot org 2009-03-01 08:07
-------
> There is a bug in the gcc compiler for the C code that changes the behavior of
> a simple program with -O2 optimizations, but not with -O1 or -O0.
-O2 enables -fstrict-aliasing so the code must be written in ISO C as far as
aliasing is concerned, otherwise the behavior is undefined.
Your code is not written in ISO C:
#define VL(X) (*((uint32*)(X)))
is a direct violation of ISO C. See the -fstrict-aliasing entry in the GCC
manual or the ISO standard.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39330