OSDN Git Service

PR c/52290
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Feb 2012 17:38:13 +0000 (17:38 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Feb 2012 17:38:13 +0000 (17:38 +0000)
* c-decl.c (start_function): Exit early if decl1 is not FUNTION_DECL.

testsuite/ChangeLog:

PR c/52290
* gcc.dg/noncompile/pr52290.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@184514 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noncompile/pr52290.c [new file with mode: 0644]

index 602ce01..4249303 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-23  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR c/52290
+       * c-decl.c (start_function): Exit early if decl1 is not FUNTION_DECL.
+
 2012-02-22  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/52330
index 6d63313..44c0ec7 100644 (file)
@@ -7594,7 +7594,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
 
   /* If the declarator is not suitable for a function definition,
      cause a syntax error.  */
-  if (decl1 == 0)
+  if (decl1 == 0
+      || TREE_CODE (decl1) != FUNCTION_DECL)
     return 0;
 
   loc = DECL_SOURCE_LOCATION (decl1);
index 0771b6e..300bcc3 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-23  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR c/52290
+       * gcc.dg/noncompile/pr52290.c: New test.
+
 2012-02-22  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/52330
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr52290.c b/gcc/testsuite/gcc.dg/noncompile/pr52290.c
new file mode 100644 (file)
index 0000000..275543c
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-error "undeclared here" "" { target *-*-* } 3 } */
+/* { dg-error "expected" "" { target *-*-* } 3 } */
+int f()[j]