[Bug c++/60124] New: g++ generates two copies of the same symbol due to __builtin_bswap32 return type
mat at lcs dot mit.edu
gcc-bugzilla@gcc.gnu.org
Sun Feb 9 13:39:00 GMT 2014
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
template<typename 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.
More information about the Gcc-bugs
mailing list