From df9fe6e5769b2bf4abaafbb3a3f0e3138abb5a8a Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Thu, 25 Dec 2003 16:08:25 +0000 Subject: [PATCH] re PR java/13404 (ICE when Missing identifier on catch clause) 2003-12-25 Andrew Pinski PR java/13404 * parse.y: (catch_clause_parameter): Return early if $3, aka formal_parameter, is null. From-SVN: r75020 --- gcc/java/ChangeLog | 6 ++++++ gcc/java/parse.y | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 68086ee9245..277ba9b2f6d 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2003-12-25 Andrew Pinski + + PR java/13404 + * parse.y: (catch_clause_parameter): Return early if $3, aka + formal_parameter, is null. + 2003-12-20 Kazu Hirata * class.c: Remove uses of "register" specifier in diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 02b445b8b60..7dfb5724a68 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -1905,15 +1905,24 @@ catch_clause_parameter: formal_parameter (CCBP). The formal parameter is declared initialized by the appropriate function call */ - tree ccpb = enter_block (); - tree init = build_assignment - (ASSIGN_TK, $2.location, TREE_PURPOSE ($3), - build (JAVA_EXC_OBJ_EXPR, ptr_type_node)); - declare_local_variables (0, TREE_VALUE ($3), - build_tree_list (TREE_PURPOSE ($3), - init)); - $$ = build1 (CATCH_EXPR, NULL_TREE, ccpb); - EXPR_WFL_LINECOL ($$) = $1.location; + tree ccpb; + tree init; + if ($3) + { + cppb = enter_block (); + init = build_assignment + (ASSIGN_TK, $2.location, TREE_PURPOSE ($3), + build (JAVA_EXC_OBJ_EXPR, ptr_type_node)); + declare_local_variables (0, TREE_VALUE ($3), + build_tree_list + (TREE_PURPOSE ($3), init)); + $$ = build1 (CATCH_EXPR, NULL_TREE, ccpb); + EXPR_WFL_LINECOL ($$) = $1.location; + } + else + { + $$ = error_mark_node; + } } | CATCH_TK error {yyerror ("'(' expected"); RECOVER; $$ = NULL_TREE;} -- 2.11.4.GIT