GCC 4.6.1 and strict-aliasing bug?

Ian Lance Taylor iant@google.com
Fri Aug 12 23:41:00 GMT 2011


Torquil Macdonald Sørensen <torquil@gmail.com> writes:

> It seems a bit strange to me that it would be a Blitz++ problem, since
> everything has worked fine using the same version of blitz++ (0.9) for
> a long time, with compiler versions all the way from after 4.1.3 up to
> and including 4.5.3. But not 4.6.1... Right now I don't remember if
> the strict-alising issue I had with 4.1.3 broke compilation or
> generated incorrect numerical results, though.

Every new version of the compiler improves optimizations.  And code with
invalid aliasing is often be compiled to behave as the programmer
expects, entirely by accident.  So there is nothing particularly
surprising in having invalid code which only acts surprisingly with
certain compiler versions.

It could certainly also be a bug in gcc.  My experience is that aliasing
issues are due to invalid code, but compiler bugs are possible too.  I
would have to see a complete example to be sure.

Ian



More information about the Gcc-help mailing list