On 11/08/11 22:56, Brian Budge wrote:
On Thu, Aug 11, 2011 at 1:46 PM, Torquil Macdonald Sørensen
<torquil@xxxxxxxxx> 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
Hi Brian!
I always compile with "-Wall -Wextra". I get no compilation warnings.
Torquil