public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60124] New: g++ generates two copies of the same symbol due to __builtin_bswap32 return type
@ 2014-02-09 13:39 mat at lcs dot mit.edu
  0 siblings, 0 replies; only message in thread
From: mat at lcs dot mit.edu @ 2014-02-09 13:39 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-09 13:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-09 13:39 [Bug c++/60124] New: g++ generates two copies of the same symbol due to __builtin_bswap32 return type mat at lcs dot mit.edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).