From: Jason Merrill Date: Tue, 9 Aug 2016 16:55:08 +0000 (-0400) Subject: PR c++/71712 - ABI tags on conversion ops. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d676d623eb1e2aabcb2d3c10574a1c240083a22a;p=gcc.git PR c++/71712 - ABI tags on conversion ops. * class.c (check_abi_tags): Don't duplicate tags for conversion ops. From-SVN: r239299 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 81ca1a1b04f..c71ea1703c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-08-09 Jason Merrill + PR c++/71712 + * class.c (check_abi_tags): Don't duplicate tags for conversion ops. + Adjust mangling of ABI tags on class template member functions. * class.c (missing_abi_tags): New. (check_abi_tags): Don't check template. Add just_checking mode. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index e21647a642e..10286a7404e 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1618,6 +1618,7 @@ check_abi_tags (tree decl) if (VAR_P (decl)) check_abi_tags (decl, TREE_TYPE (decl)); else if (TREE_CODE (decl) == FUNCTION_DECL + && !DECL_CONV_FN_P (decl) && !mangle_return_type_p (decl)) check_abi_tags (decl, TREE_TYPE (TREE_TYPE (decl))); } @@ -1632,6 +1633,9 @@ missing_abi_tags (tree decl) if (VAR_P (decl)) return check_abi_tags (decl, TREE_TYPE (decl), true); else if (TREE_CODE (decl) == FUNCTION_DECL + /* Don't check DECL_CONV_FN_P here like we do in check_abi_tags, so + that we can use this function for setting need_abi_warning + regardless of the current flag_abi_version. */ && !mangle_return_type_p (decl)) return check_abi_tags (decl, TREE_TYPE (TREE_TYPE (decl)), true); else diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index f7ff221d941..b42c6f92149 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1383,6 +1383,15 @@ write_unqualified_name (tree decl) } tree tags = get_abi_tags (decl); + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CONV_FN_P (decl) + && any_abi_below (11)) + if (tree mtags = missing_abi_tags (decl)) + { + if (abi_warn_or_compat_version_crosses (11)) + G.need_abi_warning = true; + if (!abi_version_at_least (11)) + tags = chainon (mtags, tags); + } write_abi_tags (tags); } diff --git a/gcc/testsuite/g++.dg/abi/abi-tag22.C b/gcc/testsuite/g++.dg/abi/abi-tag22.C new file mode 100644 index 00000000000..e649233b122 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag22.C @@ -0,0 +1,11 @@ +// PR c++/71712 +// { dg-options -Wabi=10 } + +struct __attribute__((abi_tag("A", "B"))) A { }; +struct A18 { + operator A(); // { dg-warning "mangled name" } +}; +void f18_test() { + // { dg-final { scan-assembler "_ZN3A18cv1AB1AB1BEv" } } + A a = A18(); +} diff --git a/gcc/testsuite/g++.dg/abi/abi-tag22a.C b/gcc/testsuite/g++.dg/abi/abi-tag22a.C new file mode 100644 index 00000000000..c27fac6963e --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag22a.C @@ -0,0 +1,11 @@ +// PR c++/71712 +// { dg-options "-fabi-version=10 -Wabi" } + +struct __attribute__((abi_tag("A", "B"))) A { }; +struct A18 { + operator A(); // { dg-warning "mangled name" } +}; +void f18_test() { + // { dg-final { scan-assembler "_ZN3A18cv1AB1AB1BB1AB1BEv" } } + A a = A18(); +}