This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Clear DECL_LANG_SPECIFIC after changing arguments (PR tree-optimization/60002)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>, Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Feb 2014 13:37:43 +0100
- Subject: [PATCH] Clear DECL_LANG_SPECIFIC after changing arguments (PR tree-optimization/60002)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
As described in the PR, while build_function_decl_skip_args
takes care of changing the type from METHOD_TYPE to FUNCTION_TYPE
if removing first argument (this), the FE may have other special arguments
that it is aware of (such as in-charge etc.) and if the this argument
is not removed, but the other arguments are, then the FE can crash
upon seeing such methods.
Fixed by clearing DECL_LANG_SPECIFIC if we remove any arguments.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2014-02-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/60002
* cgraphclones.c (build_function_decl_skip_args): Clear
DECL_LANG_SPECIFIC.
* g++.dg/opt/pr60002.C: New test.
--- gcc/cgraphclones.c.jj 2014-01-31 22:21:42.911750272 +0100
+++ gcc/cgraphclones.c 2014-02-03 19:43:30.678941701 +0100
@@ -390,6 +390,9 @@ build_function_decl_skip_args (tree orig
DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
}
+ /* The FE might have information and assumptions about the other
+ arguments. */
+ DECL_LANG_SPECIFIC (new_decl) = NULL;
return new_decl;
}
--- gcc/testsuite/g++.dg/opt/pr60002.C.jj 2014-02-03 19:43:47.671856267 +0100
+++ gcc/testsuite/g++.dg/opt/pr60002.C 2014-02-03 19:43:00.000000000 +0100
@@ -0,0 +1,12 @@
+// PR tree-optimization/60002
+// { dg-do compile }
+// { dg-options "-O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone" }
+
+struct A {};
+
+struct B : virtual A { B (); ~B (); };
+
+B::~B ()
+{
+ B ();
+}
Jakub