User account creation filtered due to spam.
When compiling the attached file with:
g++ -O3 -c gcc-crash.cpp
the following error is emitted:
gcc-crash.cpp: In member function ‘virtual A B::m()’:
gcc-crash.cpp:7: internal compiler error: in tree_nrv, at tree-nrv.c:143
This happens with gcc 4.4.5 and the current branch on SVN. It doesn't seem to happen on gcc 4.5.
Created attachment 22819 [details]
Code to reproduce the error
Created attachment 25327 [details]
bug showing ICE with -O, incorrect code without optimization
I am seeing the same crash with gcc 4.4., on x86_64. It works on 4.6.1.
I encountered this crash when simply upgrading to the latest boost (1.47.0), which uses attribute optimize, so this is likely to affect other people.
But the bug is more surprising and subtle than just the crash. It can silently generate incorrect code, which took me longer to track down.
If you compile my attached code optimized you get the internal compiler error. If you compile it unoptimized, g++ silently changes the calling convention for vector::begin from by-value to by-reference -- but only if a completely unrelated empty function is marked with attribute optimize!
In the full example this meant g++ miscompiled std::vector::begin to use the wrong calling convention, which when linked into other objects expecting the proper calling convention would cause a crash.