-
Bug
-
Resolution: Fixed
-
P1
-
1.0
-
beta
-
x86
-
windows_nt
Name: icC57033 Date: 07/01/99
Both HotSpot 1.0fcs and 1.0.1 build b fail to execute next test case:
#-------------------------- runtime003.java -------------------------
import java.io.*;
public class runtime003 {
public static int buf=0;
public static void main( String argv[] ) {
System.exit(run(argv, System.out)+95);
}
public static int run(String argv[],PrintStream out) {
int ret=0, retx=0, bad=0;
for( int i=0; (i < 100000) && (bad < 10) ; i++ ) {
retx = OptoRuntime_modf_Type(out);
ret += retx;
if( retx !=0 ) {
out.println("i="+i);
bad++;
}
}
return ret==0 ? 0 : 2 ;
}
public static int OptoRuntime_modf_Type(PrintStream out) {
int c1=2, c2=3;
int j=0, k=0;
try {
float[][] fff=new float[c1][c2];
for( j=0; j<c1; j++ ) {
for( k=0; k<c2; k++ ) {
fff[j][k]=(float)(j+1)%(float)(k+1);
}
}
} catch (Throwable e) {
out.println("Unexpected exception " + e);
e.printStackTrace(out);
out.println("j="+j+", k="+k);
return 1;
}
return 0;
}
}
#-------------------- end of runtime003.java -------------------------
While executing in -Xmixed or -Xcomp mode, HotSpot VM compiles method
OptoRuntime_modf_Type, but fails to terminate nested loop properly
and as a result throws ArrayIndexOutOfBoundException.
It seems that compiled code does not check loop variable and therefore
tries to assign array elements with indices greater then upper bound.
When the first ArrayIndexOutOfBoundException is thrown, typical values for
loops counters for PentiumII, 128 Mb, 350 Mhz, WinNT 4.0 are:
i=1111
j=0
k=14882
It is interesting, that runtime throws exception when variable k has value
much greater then upper bound of array fff.
This problem is reproduced also for double remainder.
Xint mode is OK.
Classic VM, HotSpot VM (2.0dev build a), HotSpot Client (1.3beta build i) are OK.
======================================================================
- relates to
-
JDK-4309919 HS2.0(win32): two JCK frem tests fail in stressed execution
-
- Resolved
-