This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
gcj: verification bug when exception range reaches method end
- To: java-patches@sourceware.cygnus.com
- Subject: gcj: verification bug when exception range reaches method end
- From: Gregg Townsend <gmt@baskerville.CS.Arizona.EDU>
- Date: Tue, 24 Aug 1999 11:32:43 -0700 (MST)
Gcj incorrectly reports "bad pc in exception table" if an exception
range extends all the way to the end of the method code:
p_l$rfib$main.java: In class `p_l$rfib$main':
p_l$rfib$main.java: In method `Call(jcon.vDescriptor)':
p_l$rfib$main.java:0: bad pc in exception_table
The problem is that verify_jvm_instructions() is checking the (nonexistent)
instruction beyond the end of the range for validity. Below is a patch.
---------------------------------------------------------------------------
Gregg Townsend Staff Scientist The University of Arizona
gmt@cs.arizona.edu Computer Science Tucson, Arizona, USA
*** verify.old Mon Aug 23 17:53:47 1999
--- verify.c Mon Aug 23 17:58:19 1999
*************** verify_jvm_instructions (jcf, byte_ops,
*** 397,403 ****
|| handler_pc < 0 || handler_pc >= length
|| (handler_pc >= start_pc && handler_pc < end_pc)
|| ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
! || ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START)
|| ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
{
error ("bad pc in exception_table");
--- 397,404 ----
|| handler_pc < 0 || handler_pc >= length
|| (handler_pc >= start_pc && handler_pc < end_pc)
|| ! (instruction_bits [start_pc] & BCODE_INSTRUCTION_START)
! || (end_pc < length &&
! ! (instruction_bits [end_pc] & BCODE_INSTRUCTION_START))
|| ! (instruction_bits [handler_pc] & BCODE_INSTRUCTION_START))
{
error ("bad pc in exception_table");