This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA (varpool, lto): PATCH v2 to add forward-compatibility aliases for C++ ABI bugs
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 05 Mar 2010 18:03:29 -0500
- Subject: Re: RFA (varpool, lto): PATCH v2 to add forward-compatibility aliases for C++ ABI bugs
- References: <4B8D8123.7070603@redhat.com>
I just checked in this patch to fix new unexpected fails on darwin.
commit 826db0e687da16bb5a0ca7b9f42d495b30b5a04e
Author: Jason Merrill <jason@redhat.com>
Date: Thu Mar 4 10:23:44 2010 -0500
* mangle.c (mangle_decl): Give name collision error even without
ASM_OUTPUT_DEF.
* g++.dg/abi/mangle40.C: Require weak and alias.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 3bcefbb..ea06bf7 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3057,19 +3057,21 @@ mangle_decl (const tree decl)
id = targetm.mangle_decl_assembler_name (decl, id);
SET_DECL_ASSEMBLER_NAME (decl, id);
-#ifdef ASM_OUTPUT_DEF
if (G.need_abi_warning)
{
+#ifdef ASM_OUTPUT_DEF
/* If the mangling will change in the future, emit an alias with the
future mangled name for forward-compatibility. */
int save_ver;
tree id2, alias;
+#endif
SET_IDENTIFIER_GLOBAL_VALUE (id, decl);
if (IDENTIFIER_GLOBAL_VALUE (id) != decl)
inform (DECL_SOURCE_LOCATION (decl), "-fabi-version=4 (or =0) "
"avoids this error with a change in vector mangling");
+#ifdef ASM_OUTPUT_DEF
save_ver = flag_abi_version;
flag_abi_version = 0;
id2 = mangle_decl_string (decl);
@@ -3086,8 +3088,8 @@ mangle_decl (const tree decl)
cgraph_same_body_alias (alias, decl);
else
varpool_extra_name_alias (alias, decl);
- }
#endif
+ }
}
/* Generate the mangled representation of TYPE. */
diff --git a/gcc/testsuite/g++.dg/abi/mangle40.C b/gcc/testsuite/g++.dg/abi/mangle40.C
index d73d943..f49b4da 100644
--- a/gcc/testsuite/g++.dg/abi/mangle40.C
+++ b/gcc/testsuite/g++.dg/abi/mangle40.C
@@ -1,5 +1,7 @@
// PR c++/12909
// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-require-weak }
+// { dg-require-alias }
// { dg-options "-mavx -Wabi -fabi-version=2" }
// { dg-final { scan-assembler "weak\[^\n\]*_Z1fIDv4_fEvT_" } }
// { dg-final { scan-assembler "weak\[^\n\]*_Z1fIU8__vectorfEvT_" } }