c-decl.c (finish_decl): Don't add DECL_STMTs for nested function prototypes.
authorJakub Jelinek <jakub@redhat.com>
Wed, 24 Oct 2001 14:46:44 +0000 (16:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 24 Oct 2001 14:46:44 +0000 (16:46 +0200)
* c-decl.c (finish_decl): Don't add DECL_STMTs for nested function
prototypes.

* gcc.c-torture/compile/20011023-1.c: New test.

From-SVN: r46463

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

index e58637f965b6e7417ebb561e4935cd0fbd12a970..640da380a7053362d0a49e032da93ea49750f7c0 100644 (file)
@@ -1,3 +1,8 @@
+2001-10-24  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-decl.c (finish_decl): Don't add DECL_STMTs for nested function
+       prototypes.
+
 2001-10-23  Stan Shebs  <shebs@apple.com>
 
        * config/rs6000/x-darwin: Use -no-cpp-precomp instead of
index ad724f5de48b893b1d1d08d63e7a827585dd2b4a..a5dbd928a013af750481a937dcd6be2f3a8a8706 100644 (file)
@@ -3735,7 +3735,8 @@ finish_decl (decl, init, asmspec_tree)
                SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
            }
 
-         add_decl_stmt (decl);
+         if (TREE_CODE (decl) != FUNCTION_DECL)
+           add_decl_stmt (decl);
        }
 
       if (DECL_CONTEXT (decl) != 0)
index 230b9dc107279bdf13f3ce04f27d4dcb7ff42848..106e21ab9796fc0f287cac8d1c5f22aafc62f815 100644 (file)
@@ -1,3 +1,7 @@
+2001-10-24  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20011023-1.c: New test.
+
 2001-10-23  Geoffrey Keating  <geoffk@redhat.com>
 
        * lib/g77.exp: Rewrite based on lib/g++.exp.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20011023-1.c b/gcc/testsuite/gcc.c-torture/compile/20011023-1.c
new file mode 100644 (file)
index 0000000..eca1adf
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test whether tree inlining works with prototyped nested functions.  */
+
+extern void foo (char *x);
+void bar (void);
+void bar (void)
+{
+  auto void baz (void);
+  void baz (void)
+    {
+      char tmp[2];
+      foo (tmp);
+    }
+  baz ();
+}