Need Optimizer bug workaround

Brian Dessent
Thu Apr 6 14:32:00 GMT 2006

Tina VanRoggen wrote:

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

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.)


More information about the Gcc-help mailing list