aboutsummaryrefslogtreecommitdiff
path: root/libjava/verify.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-02-06 21:53:59 +0000
committerTom Tromey <tromey@gcc.gnu.org>2002-02-06 21:53:59 +0000
commit199ecb183b32d791550aa97bd377532d742a62c1 (patch)
tree3806bc869225f6b52ce0fdf978c60ab87dbb1a5b /libjava/verify.cc
parent5e3f4df7feb38b41060ace60ed7701d9fec9d603 (diff)
downloadgcc-199ecb183b32d791550aa97bd377532d742a62c1.zip
gcc-199ecb183b32d791550aa97bd377532d742a62c1.tar.gz
gcc-199ecb183b32d791550aa97bd377532d742a62c1.tar.bz2
verify.cc (type::isnull): New method.
* verify.cc (type::isnull): New method. (require_array_type): Handle case where array is null. (verify_instructions_0) [op_arraylength]: Likewise. From-SVN: r49555
Diffstat (limited to 'libjava/verify.cc')
-rw-r--r--libjava/verify.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/libjava/verify.cc b/libjava/verify.cc
index c9cfb88..46cee15 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -522,6 +522,11 @@ private:
return false;
}
+ bool isnull () const
+ {
+ return key == null_type;
+ }
+
bool isinterface (_Jv_BytecodeVerifier *verifier)
{
resolve (verifier);
@@ -1161,6 +1166,10 @@ private:
// 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 @@ private:
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);
}