This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[PATCH] Fix PR java/13404 , an error-recover problem
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: java-patches at gcc dot gnu dot org, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Wed, 24 Dec 2003 14:21:51 -0500
- Subject: [PATCH] Fix PR java/13404 , an error-recover problem
The problem here is that $3 can be null if there was an error so this
patch fixes that
problem.
OK, bootstrapped on powerpc-apple-darwin7.2 with no regressions?
ChangeLog:
* parse.y: (catch_clause_parameter): Return early if $3, aka
formal_parameter, is
null.
Patch:
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.461
diff -u -p -r1.461 parse.y
--- parse.y 20 Dec 2003 15:38:27 -0000 1.461
+++ parse.y 24 Dec 2003 19:13:40 -0000
@@ -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;}