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
* [Bug c++/54883] Name mangling of types in an unnamed namespace
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 ` paolo.carlini at oracle dot com
2012-10-26 13:49 ` sebastian.huber@embedded-brains.de
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-10 8:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] Name mangling of types in an unnamed namespace
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
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-26 13:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
Sebastian Huber <sebastian.huber@embedded-brains.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sebastian.huber@embedded-br
| |ains.de
--- Comment #1 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-10-26 13:49:23 UTC ---
This bug is also present in x86-64 in GCC 4.6, 4.7, and 4.8.
echo "namespace { enum E { E1 }; } void f(E e) { }" | tee a.c b.c > /dev/null
g++ -c a.c -o a.o
g++ -c b.c -o b.o
objdump --syms a.o
a.o: file format elf64-x86-64
SYMBOL TABLE:
0000000000000000 l df *ABS* 0000000000000000 a.c
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .data 0000000000000000 .data
0000000000000000 l d .bss 0000000000000000 .bss
0000000000000000 l d .comment.SUSE.OPTs 0000000000000000
.comment.SUSE.OPTs
0000000000000000 l d .note.GNU-stack 0000000000000000
.note.GNU-stack
0000000000000000 l d .eh_frame 0000000000000000 .eh_frame
0000000000000000 l d .comment 0000000000000000 .comment
0000000000000000 g F .text 0000000000000009 _Z1fN12_GLOBAL__N_11EE
objdump --syms b.o
b.o: file format elf64-x86-64
SYMBOL TABLE:
0000000000000000 l df *ABS* 0000000000000000 b.c
0000000000000000 l d .text 0000000000000000 .text
0000000000000000 l d .data 0000000000000000 .data
0000000000000000 l d .bss 0000000000000000 .bss
0000000000000000 l d .comment.SUSE.OPTs 0000000000000000
.comment.SUSE.OPTs
0000000000000000 l d .note.GNU-stack 0000000000000000
.note.GNU-stack
0000000000000000 l d .eh_frame 0000000000000000 .eh_frame
0000000000000000 l d .comment 0000000000000000 .comment
0000000000000000 g F .text 0000000000000009 _Z1fN12_GLOBAL__N_11EE
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] Name mangling of types in an unnamed namespace
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
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2012-10-30 14:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
--- Comment #2 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-10-30 14:16:05 UTC ---
Known to work GCC 4.0.4, 4.1.2, and 4.2.4:
echo "namespace { enum E { E1 }; } void f(E e) { }" | tee a.c b.c
namespace { enum E { E1 }; } void f(E e) { }
/scratch/install-gcc-4.2.4/bin/g++ -c a.c -o a.o
/scratch/install-gcc-4.2.4/bin/g++ -c b.c -o b.o
nm a.o b.o
a.o:
0000000000000000 T _Z1fN32_GLOBAL__N_a.c_00000000_287815161EE
U __gxx_personality_v0
b.o:
0000000000000000 T _Z1fN32_GLOBAL__N_b.c_00000000_BE213B141EE
U __gxx_personality_v0
Known to fail 4.3.6, 4.4.7, 4.5.4, 4.6.3, 4.7.2, and 4.8.0.
Is this a bug or a feature?
In the GCC 4.3 release notes there is nothing about namespaces
(http://gcc.gnu.org/gcc-4.3/changes.html).
It would be nice if someone can point out the future direction of this PR, e.g.
NEW or RESOLVED/WONTFIX.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] [4.6/4.7/4.8 Regression] Name mangling of types in an unnamed namespace
2012-10-10 7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
` (2 preceding siblings ...)
2012-10-30 14:16 ` sebastian.huber@embedded-brains.de
@ 2012-12-09 2:50 ` pinskia at gcc dot gnu.org
2012-12-11 21:32 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-09 2:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ABI
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-12-09
Known to work| |4.2.4
Target Milestone|--- |4.6.4
Summary|Name mangling of types in |[4.6/4.7/4.8 Regression]
|an unnamed namespace |Name mangling of types in
| |an unnamed namespace
Ever Confirmed|0 |1
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-09 02:50:00 UTC ---
Confirmed.
Simple linktime testcase:
echo "namespace { enum E { E1 }; } void f(E e) { }" | tee a.c b.c > /dev/null
echo "int main(void){}"> c.c
g++ a.c b.c c.c
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] [4.6/4.7/4.8 Regression] Name mangling of types in an unnamed namespace
2012-10-10 7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
` (3 preceding siblings ...)
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
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-11 21:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] [4.6/4.7/4.8 Regression] Name mangling of types in an unnamed namespace
2012-10-10 7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
` (4 preceding siblings ...)
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
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-11 22:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-11 22:46:16 UTC ---
Author: jason
Date: Tue Dec 11 22:46:08 2012
New Revision: 194430
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194430
Log:
PR c++/54883
* decl2.c (min_vis_r): Handle anon visibility for enums.
Added:
trunk/gcc/testsuite/g++.dg/abi/anon1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] [4.6/4.7/4.8 Regression] Name mangling of types in an unnamed namespace
2012-10-10 7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
` (6 preceding siblings ...)
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
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-11 22:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-11 22:46:51 UTC ---
Author: jason
Date: Tue Dec 11 22:46:37 2012
New Revision: 194432
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194432
Log:
PR c++/54883
* decl2.c (min_vis_r): Handle anon visibility for enums.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/abi/anon1.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/decl2.c
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] [4.6/4.7/4.8 Regression] Name mangling of types in an unnamed namespace
2012-10-10 7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
` (5 preceding siblings ...)
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
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-11 22:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-11 22:46:29 UTC ---
Author: jason
Date: Tue Dec 11 22:46:22 2012
New Revision: 194431
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194431
Log:
PR c++/54883
* decl2.c (min_vis_r): Handle anon visibility for enums.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/abi/anon1.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/decl2.c
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/54883] [4.6/4.7/4.8 Regression] Name mangling of types in an unnamed namespace
2012-10-10 7:08 [Bug c++/54883] New: Name mangling of types in an unnamed namespace wolfgang.roehrl@gi-de.com
` (7 preceding siblings ...)
2012-12-11 22:47 ` jason at gcc dot gnu.org
@ 2012-12-11 22:48 ` jason at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-12-11 22:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54883
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-12-11 22:47:52 UTC ---
Fixed for 4.6.4, 4.7.3 and 4.8.
^ 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).