This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix tree inlining ICE (take 2)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: rth at redhat dot com
- Cc: aoliva at redhat dot com, aj at suse dot de, aph at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Nov 2001 12:35:30 +0100
- Subject: [PATCH] Fix tree inlining ICE (take 2)
- References: <20011119170506.G543@sunsite.ms.mff.cuni.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
My patch from yesterday did not work with the 20011119-1.c testcase I
included at -O3.
Here is a better one. The DECL_RESULT check is there so that we're sure
start_function has been called and not undone by duplicate_decls.
Bootstrapped, no regressions. Ok to commit?
2001-11-20 Jakub Jelinek <jakub@redhat.com>
* c-decl.c (c_expand_deferred_function): Only call c_expand_body
if fndecl is still DECL_INLINE and has DECL_RESULT.
* gcc.c-torture/compile/20011119-1.c: New test.
* gcc.c-torture/compile/20011119-2.c: New test.
--- gcc/testsuite/gcc.c-torture/compile/20011119-1.c.jj Tue Nov 20 00:32:50 2001
+++ gcc/testsuite/gcc.c-torture/compile/20011119-1.c Tue Nov 20 00:32:50 2001
@@ -0,0 +1,5 @@
+extern inline int foo (void)
+{
+ return 23;
+}
+extern int foo (void) __attribute__ ((weak, alias ("xxx")));
--- gcc/testsuite/gcc.c-torture/compile/20011119-2.c.jj Tue Nov 20 00:32:50 2001
+++ gcc/testsuite/gcc.c-torture/compile/20011119-2.c Tue Nov 20 00:32:50 2001
@@ -0,0 +1,13 @@
+extern inline int foo (void)
+{
+ return 23;
+}
+int bar (void)
+{
+ return foo ();
+}
+extern int foo (void) __attribute__ ((weak, alias ("xxx")));
+int baz (void)
+{
+ return foo ();
+}
--- gcc/c-decl.c.jj Tue Nov 20 00:31:17 2001
+++ gcc/c-decl.c Tue Nov 20 13:25:43 2001
@@ -6768,8 +6768,13 @@ void
c_expand_deferred_function (fndecl)
tree fndecl;
{
- c_expand_body (fndecl, 0, 0);
- current_function_decl = NULL;
+ /* DECL_INLINE or DECL_RESULT might got cleared after the inline
+ function was deferred, e.g. in duplicate_decls. */
+ if (DECL_INLINE (fndecl) && DECL_RESULT (fndecl))
+ {
+ c_expand_body (fndecl, 0, 0);
+ current_function_decl = NULL;
+ }
}
/* Generate the RTL for the body of FNDECL. If NESTED_P is non-zero,
Jakub