re PR java/12739 (gcj emits dead bytecode)

Fix PR java/12739.
* java-tree.h (BLOCK_EMPTY_P): Define.
* parse.y (java_complete_lhs): Check for empty blocks
in TRY_FINALLY_EXPR case.

From-SVN: r73690
This commit is contained in:
Jeff Sturm 2003-11-18 03:42:30 +00:00
parent e44846d6cc
commit a78e4fa764
3 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,11 @@
2003-09-12 Andrew Haley <aph@redhat.com>
2003-11-17 Jeff Sturm <jsturm@one-point.com>
Fix PR java/12739.
* java-tree.h (BLOCK_EMPTY_P): Define.
* parse.y (java_complete_lhs): Check for empty blocks
in TRY_FINALLY_EXPR case.
2003-11-17 Andrew Haley <aph@redhat.com>
* java-tree.h (LOCAL_VAR_OUT_OF_SCOPE_P): New.
(struct lang_decl_var:freed): New variable.

View File

@ -1731,6 +1731,8 @@ while (0)
#define BLOCK_EXPR_BODY(NODE) BLOCK_SUBBLOCKS(NODE)
/* True for an implicit block surrounding declaration not at start of {...}. */
#define BLOCK_IS_IMPLICIT(NODE) TREE_LANG_FLAG_1 (NODE)
#define BLOCK_EMPTY_P(NODE) \
(TREE_CODE (NODE) == BLOCK && BLOCK_EXPR_BODY (NODE) == empty_stmt_node)
#define BUILD_MONITOR_ENTER(WHERE, ARG) \
{ \

View File

@ -11719,9 +11719,13 @@ java_complete_lhs (tree node)
case TRY_FINALLY_EXPR:
COMPLETE_CHECK_OP_0 (node);
COMPLETE_CHECK_OP_1 (node);
if (TREE_OPERAND (node, 0) == empty_stmt_node)
/* Reduce try/finally nodes with an empty try block. */
if (TREE_OPERAND (node, 0) == empty_stmt_node
|| BLOCK_EMPTY_P (TREE_OPERAND (node, 0)))
return TREE_OPERAND (node, 1);
if (TREE_OPERAND (node, 1) == empty_stmt_node)
/* Likewise for an empty finally block. */
if (TREE_OPERAND (node, 1) == empty_stmt_node
|| BLOCK_EMPTY_P (TREE_OPERAND (node, 1)))
return TREE_OPERAND (node, 0);
CAN_COMPLETE_NORMALLY (node)
= (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))