c-decl.c (c_expand_deferred_function): Only call c_expand_body if fndecl is still...
authorJakub Jelinek <jakub@redhat.com>
Wed, 21 Nov 2001 11:09:01 +0000 (12:09 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 21 Nov 2001 11:09:01 +0000 (12:09 +0100)
* 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.

From-SVN: r47240

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20011119-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20011119-2.c [new file with mode: 0644]

index 6ce39fc3ae04dfab451d1c522d9f5d3b8776f46c..11eaaa81dd7053f7be14ae7977b311761e12b24e 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-21  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.
+
 2001-11-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * clipper.c (clipper_movstr): Avoid uninitialized warning.
index 4d7ca2b893655a3b6c371e25e6035334d55cb8cc..f7651c0ed299f2c2549c96816deab89718e0f356 100644 (file)
@@ -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,
index 5b593ca68fc751f8d49b132cac88f764ca8e2f42..64e2664ef7133482bad88970a152bcd54c5f71ca 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20011119-1.c: New test.
+       * gcc.c-torture/compile/20011119-2.c: New test.
+
 2001-11-17  Aldy Hernandez  <aldyh@redhat.com>
 
         * gcc.dg/altivec-1.c: Fix typo.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-1.c b/gcc/testsuite/gcc.c-torture/compile/20011119-1.c
new file mode 100644 (file)
index 0000000..02dfcdb
--- /dev/null
@@ -0,0 +1,5 @@
+extern inline int foo (void)
+{
+  return 23;
+}
+extern int foo (void) __attribute__ ((weak, alias ("xxx")));
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011119-2.c b/gcc/testsuite/gcc.c-torture/compile/20011119-2.c
new file mode 100644 (file)
index 0000000..2616368
--- /dev/null
@@ -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 ();
+}