aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 64651f5..9beb724 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -1986,6 +1986,7 @@ expand_byte_code (jcf, method)
int i;
int saw_index;
unsigned char *linenumber_pointer;
+ int dead_code_index = -1;
#undef RET /* Defined by config/i386/i386.h */
#undef AND /* Causes problems with opcodes for iand and land. */
@@ -2164,15 +2165,29 @@ expand_byte_code (jcf, method)
if (! (instruction_bits [PC] & BCODE_VERIFIED))
{
- /* never executed - skip */
- warning ("Some bytecode operations (starting at pc %d) can never be executed", PC);
- while (PC < length
- && ! (instruction_bits [PC] & BCODE_VERIFIED))
- PC++;
- continue;
+ if (dead_code_index == -1)
+ {
+ /* This is the start of a region of unreachable bytecodes.
+ They still need to be processed in order for EH ranges
+ to get handled correctly. However, we can simply
+ replace these bytecodes with nops. */
+ dead_code_index = PC;
+ }
+
+ /* Turn this bytecode into a nop. */
+ byte_ops[PC] = 0x0;
+ }
+ else
+ {
+ if (dead_code_index != -1)
+ {
+ /* We've just reached the end of a region of dead code. */
+ warning ("Unreachable bytecode from %d to before %d.",
+ dead_code_index, PC);
+ dead_code_index = -1;
+ }
}
-
/* Handle possible line number entry for this PC.
This code handles out-of-order and multiple linenumbers per PC,
@@ -2204,6 +2219,13 @@ expand_byte_code (jcf, method)
maybe_poplevels (PC);
maybe_end_try (PC);
} /* for */
+
+ if (dead_code_index != -1)
+ {
+ /* We've just reached the end of a region of dead code. */
+ warning ("Unreachable bytecode from %d to the end of the method.",
+ dead_code_index);
+ }
}
static void