For performance reasons, in 64 bit mode, C2 tries to narrow the type
of an array subscript expression to 32 bits. If at compile time, the
subscript, or the array length is deduced to be negative, the compiler
recognizes the impossibility of the value and the narrowing operation
uses a top() node to represent the expression.
At runtime, the array subscript operation is not reached because an
exception will be thrown first. However, the top() node
plays havoc with the C2 type system and should be avoided if the
conditions that generate it are recognized.
The sample program has code to allocate an array with a negative
length. Other tests show failures with negative array subscripts.