Java: fix Array_3 byte compiler failures

Andrew Haley aph@redhat.com
Thu Sep 26 11:07:00 GMT 2002


Per Bothner writes:
 > Andrew Haley wrote:
 > > The test case Array_3.java (compilation from bytecode) has been
 > > failing for a while.  It turns out that we can't compile `aconst_null;
 > > arraylength' because build_java_array_length_access() insists that its
 > > arg is of type array, whereas null_pointer_node is of type (void *).
 > 
 > Why not just test for pointer_type_node?

Good point.

 > Or just null_pointer_node?

Consider `aconst_null; astore 3; aload 3; arraylength'.  We still
don't know what kind of array we're dealing with, so the reference is
of type (void *), although it isn't null_pointer_node.

 > Actually, I think it would be cleaner to fix the tree representation.
 > The type of '(Object[]) null' should presumably be 'Object[]', not
 > 'void*'.
 > I.e. folding '(Object[]) null' to 'null' is I suspect wrong.
 > Are we stripping off a NOP_EXPR we shouldn't be?

The type of '(Object[])null' is 'Object[]' -- the NOP_EXPR is stripped
off, but the type of the pointer is definitely set correctly.  But the
issue here isn't generating incorrect bytecode, because the bytecode
is legal, I'm sure of that.

Andrew.



More information about the Gcc-patches mailing list