Bug 40459

Summary: g++.dg/abi/mangle*.C fail on darwin
Product: gcc Reporter: Dominique d'Humieres <dominiq>
Component: testsuiteAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: dnovillo, dominiq, espindola, fang, gcc-bugs, jason, mark
Priority: P3    
Version: 4.5.0   
Target Milestone: ---   
Host: *-apple-darwin9 Target: *-apple-darwin9
Build: *-apple-darwin9 Known to work:
Known to fail: Last reconfirmed: 2009-12-17 18:09:47

Description Dominique d'Humieres 2009-06-16 12:47:49 UTC
g++.dg/abi/mangle*.C fail on darwin:

FAIL: g++.dg/abi/mangle11.C  (test for warnings, line 10)
FAIL: g++.dg/abi/mangle11.C (test for excess errors)
FAIL: g++.dg/abi/mangle12.C  (test for warnings, line 11)
FAIL: g++.dg/abi/mangle12.C (test for excess errors)
FAIL: g++.dg/abi/mangle17.C  (test for warnings, line 8)
FAIL: g++.dg/abi/mangle17.C  (test for warnings, line 11)
FAIL: g++.dg/abi/mangle17.C (test for excess errors)
FAIL: g++.dg/abi/mangle20-2.C  (test for warnings, line 13)
FAIL: g++.dg/abi/mangle20-2.C (test for excess errors)

[ibook-dhum] f90/bug% g++45 -Wabi -fabi-version=1 /opt/gcc/_gcc_clean/gcc/testsuite/g++.dg/abi/mangle11.C
/opt/gcc/_gcc_clean/gcc/testsuite/g++.dg/abi/mangle11.C: In instantiation of 'void f(typename Q::X) [with Q = S, typename Q::X = int]':
/opt/gcc/_gcc_clean/gcc/testsuite/g++.dg/abi/mangle11.C:10:24:   instantiated from here
/opt/gcc/_gcc_clean/gcc/testsuite/g++.dg/abi/mangle11.C:4:25: warning: the mangled name of 'void f(typename Q::X) [with Q = S, typename Q::X = int]' will change in a future version of GCC
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Comment 1 Jack Howarth 2009-07-20 03:08:05 UTC
From the regress powerpc-apple-darwin9 tester, the last revision which doesn't show these failures was r148485 and the first to show these failures was r148498.
Comment 2 Jack Howarth 2009-07-27 14:01:46 UTC
Not having much luck regression testing this one. Revision 148492 and 148493 both fail to bootstrap on x86_64-apple-darwin.
Comment 3 Jack Howarth 2009-09-27 03:43:39 UTC
The logical candidate for these failures is...
Author: espindola
Date: Mon Jun 15 14:25:50 2009
New Revision: 148492

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148492
Log:
2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* cgraphunit.c (cgraph_function_versioning,save_inline_function_body):
	Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
	* cgraph.c (cgraph_create_virtual_clone): Use DECL_COMDAT_GROUP.
	* config/i386/i386.c (ix86_file_end): Compute DECL_COMDAT_GROUP.
	* dwarf2asm.c(dw2_force_const_mem): Update call to make_decl_one_only.
	* langhooks-def.h (lhd_comdat_group, LANG_HOOKS_COMDAT_GROUP): Remove.
	(LANG_HOOKS_DECLS): Remove LANG_HOOKS_COMDAT_GROUP.
	* langhooks.c (lhd_comdat_group): Remove.
	* langhooks.h (lang_hooks_for_decls): Remove comdat_group.
	* tree.h (DECL_COMDAT_GROUP): New.
	(DECL_ONE_ONLY): Use DECL_COMDAT_GROUP.
	(tree_decl_with_vis): Add comdat_group. Remove one_only.
	(make_decl_one_only): Change signature.
	* varasm.c (get_emutls_init_templ_addr, emutls_decl): Update call to
	make_decl_one_only.
	(make_decl_one_only): Change signature.
	(default_elf_asm_named_section): Use DECL_COMDAT_GROUP.

2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* cp-objcp-common.h (LANG_HOOKS_COMDAT_GROUP): Remove.
	* cp-tree.h (cxx_comdat_group): Change signature.
	* decl.c (duplicate_decls): Use DECL_COMDAT_GROUP.
	(cxx_comdat_group): Change signature.
	* decl2.c (comdat_linkage, maybe_make_one_only): Update call to
	make_decl_one_only.
	(constrain_visibility, get_guard): Use DECL_COMDAT_GROUP.
	* method.c (use_thunk): Update call to make_decl_one_only.
	* optimize.c (maybe_clone_body): Use DECL_COMDAT_GROUP

2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* g++.dg/abi/mangle11.C: Update warning line.
	* g++.dg/abi/mangle12.C: Update warning line.
	* g++.dg/abi/mangle17.C: Update warning line.
	* g++.dg/abi/mangle20-2.C: Update warning line.
Comment 4 Jack Howarth 2009-12-15 01:56:21 UTC
Any ideas on why we are failing this on x86_64-apple-darwin10? There we are seeing...

Executing on host: /sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../g++ -B/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../ /sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C  -nostdinc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include/x86_64-apple-darwin10.2.0 -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/testsuite/util -fmessage-length=0  -Wabi -fabi-version=1  -S  -o mangle11.s    (timeout = 300)
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C: In instantiation of 'void f(typename Q::X) [with Q = S, typename Q::X = int]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C:10:24:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C:4:25: warning: the mangled name of 'void f(typename Q::X) [with Q = S, typename Q::X = int]' will change in a future version of GCC
output is:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C: In instantiation of 'void f(typename Q::X) [with Q = S, typename Q::X = int]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C:10:24:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C:4:25: warning: the mangled name of 'void f(typename Q::X) [with Q = S, typename Q::X = int]' will change in a future version of GCC

FAIL: g++.dg/abi/mangle11.C  (test for warnings, line 10)
FAIL: g++.dg/abi/mangle11.C (test for excess errors)
Excess errors:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle11.C:4:25: warning: the mangled name of 'void f(typename Q::X) [with Q = S, typename Q::X = int]' will change in a future version of GCC


Executing on host: /sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../g++ -B/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../ /sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C  -nostdinc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include/x86_64-apple-darwin10.2.0 -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/testsuite/util -fmessage-length=0  -Wabi -fabi-version=1  -S  -o mangle12.s    (timeout = 300)
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C: In instantiation of 'void f(typename Q<int>::X) [with Q = S, typename Q<int>::X = int]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C:11:24:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C:4:30: warning: the mangled name of 'void f(typename Q<int>::X) [with Q = S, typename Q<int>::X = int]' will change in a future version of GCC
output is:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C: In instantiation of 'void f(typename Q<int>::X) [with Q = S, typename Q<int>::X = int]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C:11:24:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C:4:30: warning: the mangled name of 'void f(typename Q<int>::X) [with Q = S, typename Q<int>::X = int]' will change in a future version of GCC

FAIL: g++.dg/abi/mangle12.C  (test for warnings, line 11)
FAIL: g++.dg/abi/mangle12.C (test for excess errors)
Excess errors:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle12.C:4:30: warning: the mangled name of 'void f(typename Q<int>::X) [with Q = S, typename Q<int>::X = int]' will change in a future version of GCC


Executing on host: /sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../g++ -B/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../ /sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C  -nostdinc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include/x86_64-apple-darwin10.2.0 -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/testsuite/util -fmessage-length=0  -Wabi -fabi-version=1  -S  -o mangle17.s    (timeout = 300)
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C: In instantiation of 'void f(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:8:40:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:7:49: warning: the mangled name of 'void f(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]' will change in a future version of GCC
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C: In instantiation of 'void g(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:11:40:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:10:49: warning: the mangled name of 'void g(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]' will change in a future version of GCC
output is:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C: In instantiation of 'void f(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:8:40:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:7:49: warning: the mangled name of 'void f(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]' will change in a future version of GCC
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C: In instantiation of 'void g(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:11:40:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:10:49: warning: the mangled name of 'void g(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]' will change in a future version of GCC

FAIL: g++.dg/abi/mangle17.C  (test for warnings, line 8)
FAIL: g++.dg/abi/mangle17.C  (test for warnings, line 11)
FAIL: g++.dg/abi/mangle17.C (test for excess errors)
Excess errors:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:7:49: warning: the mangled name of 'void f(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]' will change in a future version of GCC
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle17.C:10:49: warning: the mangled name of 'void g(S<((I + e) + (int)(3.70000000000000017763568394002504646778106689453125e+0))>) [with int I = 7]' will change in a future version of GCC

Executing on host: /sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../g++ -B/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/gcc/testsuite/g++/../../ /sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C  -nostdinc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include/x86_64-apple-darwin10.2.0 -I/sw/src/fink.build/gcc45-4.4.999-20091211/darwin_objdir/x86_64-apple-darwin10.2.0/libstdc++-v3/include -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/libstdc++-v3/testsuite/util -fmessage-length=0  -fabi-version=1 -Wabi  -S  -o mangle20-2.s    (timeout = 300)
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C: In instantiation of 'void f(int (*)[2]) [with int I = 1]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C:13:30:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C:10:38: warning: the mangled name of 'void f(int (*)[2]) [with int I = 1]' will change in a future version of GCC
output is:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C: In instantiation of 'void f(int (*)[2]) [with int I = 1]':
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C:13:30:   instantiated from here
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C:10:38: warning: the mangled name of 'void f(int (*)[2]) [with int I = 1]' will change in a future version of GCC

FAIL: g++.dg/abi/mangle20-2.C  (test for warnings, line 13)
FAIL: g++.dg/abi/mangle20-2.C (test for excess errors)
Excess errors:
/sw/src/fink.build/gcc45-4.4.999-20091211/gcc-4.5-20091211/gcc/testsuite/g++.dg/abi/mangle20-2.C:10:38: warning: the mangled name of 'void f(int (*)[2]) [with int I = 1]' will change in a future version of GCC

Comment 5 Jack Howarth 2009-12-16 13:58:57 UTC
Any suggestions on how we can debug this issue further on darwin? Would this bug indicate that we are missing some section of a previous patch addressing mangling for the darwin target?
Comment 6 Jason Merrill 2009-12-16 14:11:58 UTC
It seems like you're getting the right warning message, just on a different line than expected.  I guess Rafael's checkin changed when the warning is emitted on targets that support COMDAT groups, but not on other targets.
Comment 7 Jack Howarth 2009-12-16 14:32:33 UTC
Shouldn't darwin have support for comdat? This patch, which went into FSF gcc ages ago, suggests so...

http://gcc.gnu.org/ml/gcc/2004-01/msg02186.html
Comment 8 Jack Howarth 2009-12-16 20:29:17 UTC
What's up with the instantiation portions of the warning messages in darwin? On Fedora 10, gcc trunk shows...

~/dist/bin/g++ mangle11.C -nostdinc++ -fmessage-length=0 -Wabi -fabi-version=1 -S -o mangle11.s
mangle11.C:10:24: warning: the mangled name of ‘void f(typename Q::X) [with Q = S, typename Q::X = int]’ will change in a future version of GCC

whereas on darwin with gcc-4..4.2 we get...

g++-4 mangle11.C -nostdinc++ -fmessage-length=0 -Wabi -fabi-version=1 -S -o mangle11.s
mangle11.C: In instantiation of ‘void f(typename Q::X) [with Q = S]’:
mangle11.C:10:   instantiated from here
mangle11.C:4: warning: the mangled name of ‘void f(typename Q::X) [with Q = S]’ will change in a future version of GCC

which is exactly what I see with g++-4.3.2 on Fedora 10.

g++ mangle11.C -nostdinc++ -fmessage-length=0 -Wabi -fabi-version=1 -S -o mangle11.s
mangle11.C: In instantiation of ‘void f(typename Q::X) [with Q = S]’:
mangle11.C:10:   instantiated from here
mangle11.C:4: warning: the mangled name of ‘void f(typename Q::X) [with Q = S]’ will change in a future version of GCC
Comment 9 Jack Howarth 2009-12-16 22:19:37 UTC
So I assume darwin is the only target that uses 'a poor man's comdat group' rather than a real one? I don't see any other targets failing these tests.
Comment 10 espindola 2009-12-17 18:09:47 UTC
I tried to build gcc on darwin to debug this but the build fails with a link failure (sorry, don't remember exactly where). Do I need to do something special to build on darwin?

The error message is emitted when mangling the names and the "instantiated from" bits use input_location. Yes, that is bad :-(

I assume that the difference is coming from use computing the assembler name at a different point in time when building on darwin.

The short term "fix" might be to force the assembler name computation to happen at a fixed point in time for both darwin and non-darwin systems.

The correct fix would be to not use input_location.
Comment 11 Dominique d'Humieres 2009-12-17 19:16:16 UTC
> I tried to build gcc on darwin to debug this but the build fails with a link
> failure (sorry, don't remember exactly where). Do I need to do something
> special to build on darwin?

On which version of darwin did you try the build? Where were the gmp/mpfr/mpc libraries? Do you remember the configure command?
Comment 12 Jack Howarth 2009-12-22 18:29:31 UTC
(In reply to comment #10)
> I tried to build gcc on darwin to debug this but the build fails with a link
> failure (sorry, don't remember exactly where). Do I need to do something
> special to build on darwin?
> 

Did you ever sort out your gcc build problems on darwin? Which darwin release are
you building on?
Comment 13 Mike Stump 2010-03-01 00:23:23 UTC
This is a dup of c++/42748, which has now been fixed.
Comment 14 Dominique d'Humieres 2010-03-01 10:20:16 UTC
> This is a dup of c++/42748, which has now been fixed.

So marking this pr as duplicate.


*** This bug has been marked as a duplicate of 42748 ***