From: Richard Henderson Date: Thu, 14 Oct 2004 23:20:58 +0000 (-0700) Subject: re PR c/17023 (ICE with nested functions in parameter declaration) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=559f2da552874a159ac13d13b7d5d94e3deafd10;p=gcc.git re PR c/17023 (ICE with nested functions in parameter declaration) PR c/17023 * c-decl.c (store_parm_decls_oldstyle): Care for parameter type as error_mark_node. * c-parse.in (compstmt_primary_start): Check cur_stmt_list non-null instaed of current_function_decl non-null. From-SVN: r89063 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55ba8886994..6be32d73649 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-10-14 Richard Henderson + + PR c/17023 + * c-decl.c (store_parm_decls_oldstyle): Care for parameter type + as error_mark_node. + * c-parse.in (compstmt_primary_start): Check cur_stmt_list non-null + instaed of current_function_decl non-null. + 2004-10-14 Matt Austern * pointer-set.c: New file, special-purpose hash table. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 30a154cd996..9e9813d7f78 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6002,7 +6002,8 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) if (TREE_CODE (parm) != PARM_DECL) continue; - if (!COMPLETE_TYPE_P (TREE_TYPE (parm))) + if (TREE_TYPE (parm) != error_mark_node + && !COMPLETE_TYPE_P (TREE_TYPE (parm))) { error ("%Jparameter %qD has incomplete type", parm, parm); TREE_TYPE (parm) = error_mark_node; diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 7542c3959fb..289e7c101af 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -2033,7 +2033,7 @@ compstmt_contents_nonempty: compstmt_primary_start: '(' '{' - { if (current_function_decl == 0) + { if (cur_stmt_list == NULL) { error ("braced-group within expression allowed " "only inside a function"); diff --git a/gcc/testsuite/gcc.dg/20041014-1.c b/gcc/testsuite/gcc.dg/20041014-1.c new file mode 100644 index 00000000000..699844074ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/20041014-1.c @@ -0,0 +1,10 @@ +/* PR c/17023 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +f(a, b) + int a; + int b[({ void h() {} 1; })]; /* { dg-error "braced-group" } */ +{ +}