aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-write.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-12-21 05:28:27 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-12-21 05:28:27 +0000
commit84a944b3cae32d3034bfe3360114464383419a36 (patch)
tree1a6248da57443147f39004ede5f9ef11ca3d7cde /gcc/java/jcf-write.c
parent2d93b92445219f257ccb6bee1c132f28677275fe (diff)
downloadgcc-84a944b3cae32d3034bfe3360114464383419a36.zip
gcc-84a944b3cae32d3034bfe3360114464383419a36.tar.gz
gcc-84a944b3cae32d3034bfe3360114464383419a36.tar.bz2
For PR java/4509:
* parse.y (java_complete_lhs) [COMPOUND_EXPR]: Correctly compute CAN_COMPLETE_NORMALLY for the node. * jcf-write.c (generate_bytecode_insns) [COMPOUND_EXPR]: Don't generate code for second branch if first branch can't complete normally. (generate_bytecode_insns) [LOOP_EXPR]: Don't generate `goto' to the loop head if the loop body can't complete normally. From-SVN: r48233
Diffstat (limited to 'gcc/java/jcf-write.c')
-rw-r--r--gcc/java/jcf-write.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index f6c0bfa..334465e 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -1483,7 +1483,11 @@ generate_bytecode_insns (exp, target, state)
break;
case COMPOUND_EXPR:
generate_bytecode_insns (TREE_OPERAND (exp, 0), IGNORE_TARGET, state);
- generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
+ /* Normally the first operand to a COMPOUND_EXPR must complete
+ normally. However, in the special case of a do-while
+ statement this is not necessarily the case. */
+ if (CAN_COMPLETE_NORMALLY (TREE_OPERAND (exp, 0)))
+ generate_bytecode_insns (TREE_OPERAND (exp, 1), target, state);
break;
case EXPR_WITH_FILE_LOCATION:
{
@@ -1880,7 +1884,8 @@ generate_bytecode_insns (exp, target, state)
{
struct jcf_block *head_label = get_jcf_label_here (state);
generate_bytecode_insns (body, IGNORE_TARGET, state);
- emit_goto (head_label, state);
+ if (CAN_COMPLETE_NORMALLY (body))
+ emit_goto (head_label, state);
}
}
break;