Bug#630441: g++-4.6 miscompilation
Philip Ashmore <firstname.lastname@example.org> writes:
> It appears that gcc-4.6 (and clang for that matter) make some dodgy
> decisions about what appear to be references to temporaries created
> during optimization.
You don't seem to have addressed the issue raised by Matthias Klose in
the bug thread though: specifically, whether this is truly a compiler
problem, or simply buggy code exposed by the newer compilers.
That it works as intended with older compilers or -O0 isn't enough to
show that -- it's very common for buggy code to work correctly for a
long time, and then suddenly stop working when a new compiler release
uses more aggressive [but correct] optimization.
It seems like an important step here would be to reduce this down to a
minimal test case.
[The fact that both newer versions of gcc and clang show the same
behavior does suggest that maybe it's the application code which is
One of the lessons of history is that nothing is often a good thing to
do, and always a clever thing to say. -- Will Durant