This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix tree inlining ICE (take 2)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]