[PATCH, PR 43257] Mangle DECL_ASSEMBLER_NAME early in IPA-SRA
Martin Jambor
mjambor@suse.cz
Tue Mar 9 21:58:00 GMT 2010
Hi,
the patch below makes IPA-SRA mangle the assembler name of a function
decl before changing its type to avoid potential conflicts with other
functions.
Bootstrapped and regression tested on x86_64-linux. OK for trunk?
Thanks,
Martin
2010-03-09 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43257
* ipa-prop.c (ipa_modify_formal_parameters): Call
set_decl_assembler_name if not already set.
* testsuite/g++.dg/torture/pr43257.C: New test.
Index: mine/gcc/ipa-prop.c
===================================================================
--- mine.orig/gcc/ipa-prop.c
+++ mine/gcc/ipa-prop.c
@@ -1497,6 +1497,9 @@ ipa_modify_formal_parameters (tree fndec
if (!synth_parm_prefix)
synth_parm_prefix = "SYNTH";
+ if (!DECL_ASSEMBLER_NAME_SET_P (fndecl))
+ lang_hooks.set_decl_assembler_name (fndecl);
+
oparms = ipa_get_vector_of_formal_parms (fndecl);
orig_type = TREE_TYPE (fndecl);
old_arg_types = TYPE_ARG_TYPES (orig_type);
Index: mine/gcc/testsuite/g++.dg/torture/pr43257.C
===================================================================
--- /dev/null
+++ mine/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+
+class A {};
+class B {};
+
+static void *func (int n)
+{
+ void *p;
+ if (p == 0) throw ::A ();
+}
+
+static void *func (int n, B const &)
+{
+ try {
+ return func (n);
+ }
+ catch (::A const &) {
+ }
+ return func (n);
+}
+
+void *f1 (int n)
+{
+ return func (n, B());
+}
+
+void *f2 (int n)
+{
+ return func (n, B());
+}
More information about the Gcc-patches
mailing list