aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-09-14 15:54:27 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-09-14 15:54:27 -0400
commit65440c482af0345046416641750df7897c33dc49 (patch)
tree243060f6ed516255301acf65400759f8d5bd218b /gcc
parent0d179691da597b8e2cb9ff55a5875f2c60e1cfbd (diff)
downloadgcc-65440c482af0345046416641750df7897c33dc49.zip
gcc-65440c482af0345046416641750df7897c33dc49.tar.gz
gcc-65440c482af0345046416641750df7897c33dc49.tar.bz2
re PR c++/44282 (fastcall is not mangled at all)
PR c++/44282 * mangle.c (write_CV_qualifiers_for_type): Also warn about regparm mangling with lower -fabi-version. From-SVN: r227761
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/mangle.c45
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle-regparm1a.C21
3 files changed, 51 insertions, 21 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 76e3b91..c264f48 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/44282
+ * mangle.c (write_CV_qualifiers_for_type): Also warn about regparm
+ mangling with lower -fabi-version.
+
2015-09-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51911
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 342cb93..2640d52 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2196,7 +2196,7 @@ write_CV_qualifiers_for_type (const tree type)
We don't do this with classes and enums because their attributes
are part of their definitions, not something added on. */
- if (abi_version_at_least (10) && !OVERLOAD_TYPE_P (type))
+ if (!OVERLOAD_TYPE_P (type))
{
auto_vec<tree> vec;
for (tree a = TYPE_ATTRIBUTES (type); a; a = TREE_CHAIN (a))
@@ -2207,31 +2207,34 @@ write_CV_qualifiers_for_type (const tree type)
&& !is_attribute_p ("abi_tag", name))
vec.safe_push (a);
}
- vec.qsort (attr_strcmp);
- while (!vec.is_empty())
+ if (abi_version_crosses (10) && !vec.is_empty ())
+ G.need_abi_warning = true;
+ if (abi_version_at_least (10))
{
- tree a = vec.pop();
- const attribute_spec *as
- = lookup_attribute_spec (get_attribute_name (a));
-
- write_char ('U');
- write_unsigned_number (strlen (as->name));
- write_string (as->name);
- if (TREE_VALUE (a))
+ vec.qsort (attr_strcmp);
+ while (!vec.is_empty())
{
- write_char ('I');
- for (tree args = TREE_VALUE (a); args;
- args = TREE_CHAIN (args))
+ tree a = vec.pop();
+ const attribute_spec *as
+ = lookup_attribute_spec (get_attribute_name (a));
+
+ write_char ('U');
+ write_unsigned_number (strlen (as->name));
+ write_string (as->name);
+ if (TREE_VALUE (a))
{
- tree arg = TREE_VALUE (args);
- write_template_arg (arg);
+ write_char ('I');
+ for (tree args = TREE_VALUE (a); args;
+ args = TREE_CHAIN (args))
+ {
+ tree arg = TREE_VALUE (args);
+ write_template_arg (arg);
+ }
+ write_char ('E');
}
- write_char ('E');
- }
- ++num_qualifiers;
- if (abi_version_crosses (10))
- G.need_abi_warning = true;
+ ++num_qualifiers;
+ }
}
}
diff --git a/gcc/testsuite/g++.dg/abi/mangle-regparm1a.C b/gcc/testsuite/g++.dg/abi/mangle-regparm1a.C
new file mode 100644
index 0000000..bfa6c9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle-regparm1a.C
@@ -0,0 +1,21 @@
+// { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } }
+// { dg-options "-fabi-version=8 -Wabi -save-temps" }
+// { dg-final { scan-assembler "_Z18IndirectExternCallIPFviiEiEvT_T0_S3_" } }
+
+template <typename F, typename T>
+void IndirectExternCall(F f, T t1, T t2) { // { dg-warning "mangled name" }
+ typedef F (*WrapF)(F);
+ f (t1, t2);
+}
+
+__attribute__((regparm(3), stdcall))
+void regparm_func (int i, int j)
+{
+ if (i != 24 || j != 42)
+ __builtin_abort();
+}
+
+int main()
+{
+ IndirectExternCall (regparm_func, 24, 42);
+}