This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]