Java: fix Array_3 byte compiler failures

Per Bothner per@bothner.com
Thu Sep 26 11:51:00 GMT 2002


Andrew Haley wrote:
> 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.

Well, somebody is stripping off the type before it gets to
build_java_array_length_access, or else your patch would have
no effect. My point is: If the type of the argument to
build_java_array_length_access is pointer_type_node then
I think that indicates a bug before we get that far.
In your initial posting you said that:
 aconst_null
 arraylength
is valid bytecode.
I don't believe it is; javac generates from
 ((Object[] null).length
the following
 aconst_null
 checkcast #9=<Class [Ljava.lang.Object;>
 arraylength
I.e. somewhere you're losing type information,
and your patch is fixing the symptom, not the bug.
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /