Hi Tom,
On Wed, 2002-02-06 at 22:35, Tom Tromey wrote:
>
> Thanks. I've checked in a new test case for this (they are in the
> Mauve "verify" module). Interestingly, gcj crashes on the test case.
>
> I've also written a verifier patch which I am testing. I'll check it
> in once that is done.
Wow, you are quick. I made a patch myself which I have attached. With
this patch I don't get any array related VerifyErrors which either means
my patch is completely broken or jikes doesn't generate faulty array
accesses. I am interested in how your fix looks.
> Mark> Now I am debugging the verifier when I wanted to debug jikes
> Mark> bytecode generation :)
>
> Sorry about that.
Don't worry about it. I learned a lot today.
Cheers,
Mark
Index: verify.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/verify.cc,v
retrieving revision 1.32
diff -u -r1.32 verify.cc
--- verify.cc 2002/02/01 05:48:00 1.32
+++ verify.cc 2002/02/06 21:23:08
@@ -1161,6 +1161,10 @@
// compatible with type ELEMENT. Returns the actual element type.
type require_array_type (type array, type element)
{
+ // If array is null pretend that it contains ELEMENT type.
+ if (array.key == null_type)
+ return element;
+
if (! array.isarray ())
verify_fail ("array required");
@@ -2796,7 +2800,7 @@
case op_arraylength:
{
type t = pop_type (reference_type);
- if (! t.isarray ())
+ if (! t.isarray () && t.key != null_type)
verify_fail ("array type expected");
push_type (int_type);
}