This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: verifier bug: arraylength -vs- null
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 06 Feb 2002 15:12:07 -0700
- Subject: Patch: FYI: verifier bug: arraylength -vs- null
- Reply-to: tromey at redhat dot com
I'm checking this in.
This fixes a verifier bug pointed out by Mark Wielaard.
I've checked in a test case for this to Mauve.
gcj crashes on this test; I'll try to submit a full report later.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* verify.cc (type::isnull): New method.
(require_array_type): Handle case where array is null.
(verify_instructions_0) [op_arraylength]: Likewise.
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:32:44
@@ -522,6 +522,11 @@
return false;
}
+ bool isnull () const
+ {
+ return key == null_type;
+ }
+
bool isinterface (_Jv_BytecodeVerifier *verifier)
{
resolve (verifier);
@@ -1161,6 +1166,10 @@
// compatible with type ELEMENT. Returns the actual element type.
type require_array_type (type array, type element)
{
+ // An odd case. Here we just pretend that everything went ok.
+ if (array.isnull ())
+ return element;
+
if (! array.isarray ())
verify_fail ("array required");
@@ -2796,7 +2805,7 @@
case op_arraylength:
{
type t = pop_type (reference_type);
- if (! t.isarray ())
+ if (! t.isarray () && ! t.isnull ())
verify_fail ("array type expected");
push_type (int_type);
}