[Bug c++/60124] New: g++ generates two copies of the same symbol due to __builtin_bswap32 return type
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60124 Bug ID: 60124 Summary: g++ generates two copies of the same symbol due to __builtin_bswap32 return type Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mat at lcs dot mit.edu templatetypename T T identity(T x) { return x; } void fail() { identity(0U); identity(__builtin_bswap32(0)); } $ ~/gcc-4.8.2-install/bin/g++ -c ~/symbol_error.cpp -o ~/symbol_error.o /tmp/ccojWORv.s: Assembler messages: /tmp/ccojWORv.s:44: Error: symbol `_Z8identityIjET_S0_' is already defined It's as if g++ thinks the return type of __builtin_bswap32 is different for template interning, but the same for name mangling, so it produces bad assembly code with the same symbol used twice. This also fails with g++ 4.6.3 and 4.7.2. It works with clang 3.1 and 3.4.
[Bug c++/47011] ICE when using attribute optimize
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47011 --- Comment #2 from Mat Hostetter mat at lcs dot mit.edu 2011-09-20 12:31:56 UTC --- Created attachment 25327 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25327 bug showing ICE with -O, incorrect code without optimization
[Bug c++/47011] ICE when using attribute optimize
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47011 --- Comment #3 from Mat Hostetter mat at lcs dot mit.edu 2011-09-20 12:32:47 UTC --- I am seeing the same crash with gcc 4.4.[3456], 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.