public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54883] New: Name mangling of types in an unnamed namespace
@ 2012-10-10  7:08 wolfgang.roehrl@gi-de.com
  2012-10-10  8:50 ` [Bug c++/54883] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: wolfgang.roehrl@gi-de.com @ 2012-10-10  7:08 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883

             Bug #: 54883
           Summary: Name mangling of types in an unnamed namespace
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wolfgang.roehrl@gi-de.com


Hi all,

I would like to post a bug report for the GNU C/C++ compiler
version 4.5.2 (powerpc-rtems4.11).

We use the compiler to generate code for a PowerPC processor.

The compiler is invoked with the following options:

ccppc -c -x c++ -ansi -Wall -Werror -g -mcpu=8540 -fverbose-asm -mbig
      -mfloat-gprs=double -mspe -mabi=spe -meabi -msdata -fno-common
      -mmultiple -mno-string -misel -mstrict-align -fgcse-sm
      -fno-rename-registers -fno-section-anchors -G 8 -Os
      -fno-exceptions -fno-rtti
      -I<some include paths>
      -D<some #define's>
      TEST1.CPP -oTEST1.O


// file TEST1.CPP

namespace { enum E { E1, E2, E3 }; }   // unnamed namespace

int func (E e) { return e; }


// file TEST2.CPP

namespace { enum E { E1, E2, E3 }; }   // unnamed namespace

int func (E e) { return e; }


The compiler translates in both files the name of func() to the decorated
name "_Z4funcN12_GLOBAL__N_11EE". This is wrong because the enums E are
different types due to the unnamed namespaces.

In our system the functions func() are template functions und therefore the
linker merges them into one function in the object file which leads to a wrong
program behavior.

BTW, our compiler version 4.3.2 shows this error too, whereas our compiler
version 3.3 seems to perform a correct name mangling.

With kind regards
W. Roehrl


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-12-11 22:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10  7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
2012-10-10  8:50 ` [Bug c++/54883] " paolo.carlini at oracle dot com
2012-10-26 13:49 ` sebastian.huber@embedded-brains.de
2012-10-30 14:16 ` sebastian.huber@embedded-brains.de
2012-12-09  2:50 ` [Bug c++/54883] [4.6/4.7/4.8 Regression] " pinskia at gcc dot gnu.org
2012-12-11 21:32 ` jason at gcc dot gnu.org
2012-12-11 22:46 ` jason at gcc dot gnu.org
2012-12-11 22:47 ` jason at gcc dot gnu.org
2012-12-11 22:47 ` jason at gcc dot gnu.org
2012-12-11 22:48 ` jason at gcc dot gnu.org

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).