Need Optimizer bug workaround

Brian Dessent brian@dessent.net
Thu Apr 6 14:32:00 GMT 2006


Tina VanRoggen wrote:

>         tobj->SetParameter(4110, *(long *) &p1);

http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html

Just to be clear, this is a violation of the ISO C pointer aliasing
rules.  These rules were put in the standard to allow compilers to do a
better job of optimizing, and here gcc 4.x is taking advantage of them
where it did not in prior versions.  It does not mean there is a bug in
gcc, it means you need to fix your code to not use this construct (or
the suboptimal solution of instructing gcc to relax its aliasing
enforcement with -fno-strict-aliasing as mentioned already.)

Brian



More information about the Gcc-help mailing list