diff options
author | Jeff Sturm <jsturm@gcc.gnu.org> | 2003-11-18 03:42:30 +0000 |
---|---|---|
committer | Jeff Sturm <jsturm@gcc.gnu.org> | 2003-11-18 03:42:30 +0000 |
commit | a78e4fa7643f1264968e86476a2f39a2a241f202 (patch) | |
tree | 436e45b83f98cf7428f89e2219412eb6350203fe /gcc/java | |
parent | e44846d6cc11782725608b7ef84b61daafe17abc (diff) | |
download | gcc-a78e4fa7643f1264968e86476a2f39a2a241f202.zip gcc-a78e4fa7643f1264968e86476a2f39a2a241f202.tar.gz gcc-a78e4fa7643f1264968e86476a2f39a2a241f202.tar.bz2 |
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
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 2 | ||||
-rw-r--r-- | gcc/java/parse.y | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 301a4a7..995b21a 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -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. diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 8c58bb7..eb0db48 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -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) \ { \ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 8a13e51..375e7ec 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -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)) |