re PR c++/12909 (ambiguity in mangling vector types)
PR c++/12909 * mangle.c: Include cgraph.h. (mangle_decl): If the mangled name will change in a later ABI version, make the later mangled name an alias. * method.c (make_alias_for): Copy DECL_ARGUMENTS. * Make-lang.in (mangle.o): Depend on cgraph.h. From-SVN: r157201
This commit is contained in:
parent
2587aa3b36
commit
58a15cf8ee
@ -1,3 +1,12 @@
|
||||
2010-03-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/12909
|
||||
* mangle.c: Include cgraph.h.
|
||||
(mangle_decl): If the mangled name will change in a later
|
||||
ABI version, make the later mangled name an alias.
|
||||
* method.c (make_alias_for): Copy DECL_ARGUMENTS.
|
||||
* Make-lang.in (mangle.o): Depend on cgraph.h.
|
||||
|
||||
2010-03-01 Marco Poletti <poletti.marco@gmail.com>
|
||||
|
||||
* pt.c (redeclare_class_template): Use error_n and inform_n.
|
||||
|
@ -308,7 +308,7 @@ cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h $(INTEGRATE_H) \
|
||||
insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \
|
||||
$(TARGET_H) tree-iterator.h $(CGRAPH_H)
|
||||
cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h $(REAL_H) \
|
||||
gt-cp-mangle.h $(TARGET_H) $(TM_P_H)
|
||||
gt-cp-mangle.h $(TARGET_H) $(TM_P_H) $(CGRAPH_H)
|
||||
cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_H) gt-cp-parser.h \
|
||||
output.h $(TARGET_H) $(PLUGIN_H) intl.h
|
||||
cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) toplev.h $(C_COMMON_H) \
|
||||
|
@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
#include "varray.h"
|
||||
#include "flags.h"
|
||||
#include "target.h"
|
||||
#include "cgraph.h"
|
||||
|
||||
/* Debugging support. */
|
||||
|
||||
@ -3055,6 +3056,38 @@ mangle_decl (const tree decl)
|
||||
tree id = mangle_decl_string (decl);
|
||||
id = targetm.mangle_decl_assembler_name (decl, id);
|
||||
SET_DECL_ASSEMBLER_NAME (decl, id);
|
||||
|
||||
#ifdef ASM_OUTPUT_DEF
|
||||
if (G.need_abi_warning)
|
||||
{
|
||||
/* 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;
|
||||
|
||||
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");
|
||||
|
||||
if (TREE_CODE (decl) != FUNCTION_DECL)
|
||||
return;
|
||||
|
||||
save_ver = flag_abi_version;
|
||||
flag_abi_version = 0;
|
||||
id2 = mangle_decl_string (decl);
|
||||
id2 = targetm.mangle_decl_assembler_name (decl, id2);
|
||||
flag_abi_version = save_ver;
|
||||
|
||||
alias = make_alias_for (decl, id2);
|
||||
DECL_IGNORED_P (alias) = 1;
|
||||
TREE_PUBLIC (alias) = TREE_PUBLIC (decl);
|
||||
DECL_VISIBILITY (alias) = DECL_VISIBILITY (decl);
|
||||
if (vague_linkage_fn_p (decl))
|
||||
DECL_WEAK (alias) = 1;
|
||||
cgraph_same_body_alias (alias, decl);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Generate the mangled representation of TYPE. */
|
||||
|
@ -234,6 +234,7 @@ make_alias_for (tree function, tree newid)
|
||||
DECL_TEMPLATE_INSTANTIATED (alias) = 0;
|
||||
DECL_TEMPLATE_INFO (alias) = NULL;
|
||||
DECL_INITIAL (alias) = error_mark_node;
|
||||
DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
|
||||
TREE_ADDRESSABLE (alias) = 1;
|
||||
TREE_USED (alias) = 1;
|
||||
SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
|
||||
|
@ -1,3 +1,9 @@
|
||||
2010-03-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/12909
|
||||
* g++.dg/abi/mangle40.C: New.
|
||||
* g++.dg/abi/mangle41.C: New.
|
||||
|
||||
2010-03-03 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/43243
|
||||
|
25
gcc/testsuite/g++.dg/abi/mangle40.C
Normal file
25
gcc/testsuite/g++.dg/abi/mangle40.C
Normal file
@ -0,0 +1,25 @@
|
||||
// PR c++/12909
|
||||
// { dg-do compile { target i?86-*-* x86_64-*-* } }
|
||||
// { dg-options "-mavx -Wabi -fabi-version=2" }
|
||||
// { dg-final { scan-assembler "weak\[^\n\]*_Z1fIDv4_fEvT_" } }
|
||||
// { dg-final { scan-assembler "weak\[^\n\]*_Z1fIU8__vectorfEvT_" } }
|
||||
// { dg-final { scan-assembler "weak\[^\n\]*_ZN1AIU8__vectorfE1tE" } }
|
||||
|
||||
#include <x86intrin.h>
|
||||
|
||||
template <class T>
|
||||
struct A
|
||||
{
|
||||
static T t;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
T A<T>::t; // { dg-warning "mangled name" }
|
||||
|
||||
template <class T>
|
||||
void f (T t) { } // { dg-warning "mangled name" }
|
||||
|
||||
int main()
|
||||
{
|
||||
f (A<__m128>::t);
|
||||
}
|
7
gcc/testsuite/g++.dg/abi/mangle41.C
Normal file
7
gcc/testsuite/g++.dg/abi/mangle41.C
Normal file
@ -0,0 +1,7 @@
|
||||
// PR c++/41959
|
||||
// { dg-do compile { target i?86-*-* x86_64-*-* } }
|
||||
// { dg-options "-mavx -fabi-version=2" }
|
||||
|
||||
#include <x86intrin.h>
|
||||
void f(__m128) { } // { dg-error "previous" }
|
||||
void f(__m256) { } // { dg-message "declaration|mangling" }
|
Loading…
Reference in New Issue
Block a user