GCC 4.6.1 and strict-aliasing bug?

Brian Budge brian.budge@gmail.com
Thu Aug 11 20:57:00 GMT 2011


On Thu, Aug 11, 2011 at 1:46 PM, Torquil Macdonald Sørensen
<torquil@gmail.com> wrote:

> If I compile with "-O2", it prints 0, which is wrong.
>
> If I compile with "-O2 -fno-strict-aliasing", it prints the correct answer
> 1.6666..
>
> I've verified that the problems goes away after downgrading to g++-4.5.3.

> Best regards and thanks,
> Torquil Sørensen
>

Have you tried compiling with -Wall?  It would be interesting to see
if the compiler thinks there's a strict aliasing violation.

  Brian



More information about the Gcc-help mailing list