This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: java/8025: ICE when bytecode does array access on null
- From: Eric Blake <ebb9 at email dot byu dot edu>
- To: gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, ebb9 at email dot byu dot edu,gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: Thu, 26 Sep 2002 16:10:58 -0600
- Subject: Re: java/8025: ICE when bytecode does array access on null
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8025
Andrew Haley pointed out that arraylength also suffers from the same
fate - see this thread: http://gcc.gnu.org/ml/java/2002-09/msg00241.html
I also confirmed that the jikes compiler allows the following:
class Foo {
public static void main(String[] args) {
int i = ((Object[]) null).length;
((Object[]) null)[0] = null;
}
}
This compiled to:
Method void main(java.lang.String[])
0 aconst_null
1 arraylength
2 istore_1
3 aconst_null
4 iconst_0
5 aconst_null
6 aastore
7 return
And successfully verified with JDK 1.4.1. So it is possible to use null
types directly, instead of storing them into a local variable first.