This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/54883] New: Name mangling of types in an unnamed namespace


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]