From: Uros Bizjak Date: Thu, 23 Feb 2012 18:01:45 +0000 (+0100) Subject: re PR c/52290 (internal compiler error: tree check: expected function_decl, have... X-Git-Tag: releases/gcc-4.5.4~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=358b15989ab2180313744f0a497745e45b804336;p=thirdparty%2Fgcc.git re PR c/52290 (internal compiler error: tree check: expected function_decl, have var_decl in start_function, at c-decl.c:7712) PR c/52290 * 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. From-SVN: r184517 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 22e48889e13d..230c266a8b52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-02-23 Uros Bizjak + + PR c/52290 + * c-decl.c (start_function): Exit early if decl1 is not FUNTION_DECL. + 2012-02-22 Uros Bizjak PR target/52330 diff --git a/gcc/c-decl.c b/gcc/c-decl.c index abb4bdeee2af..3fb2f173e6fe 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7385,7 +7385,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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdf80bcc8dc6..b89bd70ab088 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-02-23 Uros Bizjak + + PR c/52290 + * gcc.dg/noncompile/pr52290.c: New test. + 2012-02-22 Uros Bizjak 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 index 000000000000..275543cfca9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/pr52290.c @@ -0,0 +1,3 @@ +/* { dg-error "undeclared here" "" { target *-*-* } 3 } */ +/* { dg-error "expected" "" { target *-*-* } 3 } */ +int f()[j]