-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
x86
-
windows_nt
-
Not verified
Sample program below contains cyclic invocations of the method :
private static strictfp float retPar(float par) {
return par;
}
'strictfp' modifier demands rounding float-extended parameter value to standard float value
and returning standard float value too.
But Symantec JIT 3.00.066(x) (JDK 1.2fcs-F, -G) allows float-extended value to pass through
this method without rounding when invocations occur in a loop. Expressions are calculated
correctly for FP-wide mode. There is possible incorrect inlining of the method.
Note, that failure occurs after 32d iteration only.
The sample runs correctly on win32 under JDK 1.2fcsE, JIT Version 3.00.063(x) and JDK 1.2fcsF and G
with interpreter. It also works correctly on Sun SPARC, JDK 1.2b4K and 1.2fcs E, F and G.
This bug affects the following test in JCK 1.2beta4:
lang/FP/fpl007/fpl00702m1/fpl00702m1.html
========================================= retPar.java
import java.io.PrintStream;
widefp public class retPar {
static PrintStream out;
static float halfUlp;
static {
halfUlp = 1;
for ( int i = 127 - 24; i > 0; i-- )
halfUlp *= 2;
}
public static void main(String argv[]) {
out = System.out;
pr(-1,"halfUlp",halfUlp);
retPar obj = new retPar();
for( int i=0; i<48; i++ )
obj.instanceMethod( i );
}
private static void pr(int i, String desc, float r) {
out.print(" i=("+i+") "+desc+" ; == "+r);
out.println(" , 0x"+Integer.toHexString(Float.floatToIntBits(r)));
}
//-----------------------------------------------------
private static strictfp float retPar(float par) {
return par;
}
public static strictfp float strictValue(int i) {
float r;
switch (i%4) {
case 0: r = -Float.MAX_VALUE; break;
case 1: r = Float.MAX_VALUE; break;
case 2: r = Float.MIN_VALUE; break;
default : r = 1L << 24;
}
return r;
}
widefp void instanceMethod (int i) {
float r;
switch (i%4) {
case 0: if ( !Float.isInfinite( retPar(strictValue(i)*2) + Float.MAX_VALUE ) ) {
pr(i,"retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY"
,retPar(strictValue(i)*2) + Float.MAX_VALUE);
}
r = retPar(strictValue(i)*2) + Float.MAX_VALUE;
if ( !Float.isInfinite( r ) ) {
pr(i,"r != Float.NEGATIVE_INFINITY",r);
}
break;
case 1: if ( !Float.isInfinite( retPar(strictValue(i)+halfUlp) - Float.MAX_VALUE ) ) {
pr(i,"retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY"
,retPar(strictValue(i)+halfUlp) - Float.MAX_VALUE);
}
r = retPar(strictValue(i)+halfUlp) - Float.MAX_VALUE;
if ( !Float.isInfinite( r ) ) {
pr(i,"r != Float.POSITIVE_INFINITY",r);
}
break;
case 2: if ( retPar(strictValue(i)/2) != 0 ) {
pr(i,"retPar(Float.MIN_VALUE/2) != 0",retPar(strictValue(i)/2));
}
r = retPar(strictValue(i)/2);
if ( r != 0 ) {
pr(i,"r != 0",r);
}
break;
default: if ( retPar(strictValue(i)-0.5f) - strictValue(i) != 0 ) {
pr(i,"retPar(2^24-0.5) != 2^24",retPar(strictValue(i)-0.5f));
}
r = retPar(strictValue(i)-0.5f);
if ( r - strictValue(i) != 0 ) {
pr(i,"r != 2^24",r);
}
}
}
}
========================================= retPar.trace
H:\ld32\inev\tmp\fp> H:\ld14\java\dest\jdk1.2fcsG\win32\bin\java retPar
i=(-1) halfUlp ; == 1.0141205E31 , 0x73000000
i=(32) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(32) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(33) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(33) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(35) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
i=(36) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(36) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(37) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(37) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(39) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
i=(40) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(40) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(41) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(41) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(43) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
i=(44) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(44) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(45) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(45) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(47) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
H:\ld32\inev\tmp\fp> H:\ld14\java\dest\jdk1.2fcsG\win32\bin\java retPar
Warning: JIT compiler "inev" not found. Will use interpreter.
i=(-1) halfUlp ; == 1.0141205E31 , 0x73000000
private static strictfp float retPar(float par) {
return par;
}
'strictfp' modifier demands rounding float-extended parameter value to standard float value
and returning standard float value too.
But Symantec JIT 3.00.066(x) (JDK 1.2fcs-F, -G) allows float-extended value to pass through
this method without rounding when invocations occur in a loop. Expressions are calculated
correctly for FP-wide mode. There is possible incorrect inlining of the method.
Note, that failure occurs after 32d iteration only.
The sample runs correctly on win32 under JDK 1.2fcsE, JIT Version 3.00.063(x) and JDK 1.2fcsF and G
with interpreter. It also works correctly on Sun SPARC, JDK 1.2b4K and 1.2fcs E, F and G.
This bug affects the following test in JCK 1.2beta4:
lang/FP/fpl007/fpl00702m1/fpl00702m1.html
========================================= retPar.java
import java.io.PrintStream;
widefp public class retPar {
static PrintStream out;
static float halfUlp;
static {
halfUlp = 1;
for ( int i = 127 - 24; i > 0; i-- )
halfUlp *= 2;
}
public static void main(String argv[]) {
out = System.out;
pr(-1,"halfUlp",halfUlp);
retPar obj = new retPar();
for( int i=0; i<48; i++ )
obj.instanceMethod( i );
}
private static void pr(int i, String desc, float r) {
out.print(" i=("+i+") "+desc+" ; == "+r);
out.println(" , 0x"+Integer.toHexString(Float.floatToIntBits(r)));
}
//-----------------------------------------------------
private static strictfp float retPar(float par) {
return par;
}
public static strictfp float strictValue(int i) {
float r;
switch (i%4) {
case 0: r = -Float.MAX_VALUE; break;
case 1: r = Float.MAX_VALUE; break;
case 2: r = Float.MIN_VALUE; break;
default : r = 1L << 24;
}
return r;
}
widefp void instanceMethod (int i) {
float r;
switch (i%4) {
case 0: if ( !Float.isInfinite( retPar(strictValue(i)*2) + Float.MAX_VALUE ) ) {
pr(i,"retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY"
,retPar(strictValue(i)*2) + Float.MAX_VALUE);
}
r = retPar(strictValue(i)*2) + Float.MAX_VALUE;
if ( !Float.isInfinite( r ) ) {
pr(i,"r != Float.NEGATIVE_INFINITY",r);
}
break;
case 1: if ( !Float.isInfinite( retPar(strictValue(i)+halfUlp) - Float.MAX_VALUE ) ) {
pr(i,"retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY"
,retPar(strictValue(i)+halfUlp) - Float.MAX_VALUE);
}
r = retPar(strictValue(i)+halfUlp) - Float.MAX_VALUE;
if ( !Float.isInfinite( r ) ) {
pr(i,"r != Float.POSITIVE_INFINITY",r);
}
break;
case 2: if ( retPar(strictValue(i)/2) != 0 ) {
pr(i,"retPar(Float.MIN_VALUE/2) != 0",retPar(strictValue(i)/2));
}
r = retPar(strictValue(i)/2);
if ( r != 0 ) {
pr(i,"r != 0",r);
}
break;
default: if ( retPar(strictValue(i)-0.5f) - strictValue(i) != 0 ) {
pr(i,"retPar(2^24-0.5) != 2^24",retPar(strictValue(i)-0.5f));
}
r = retPar(strictValue(i)-0.5f);
if ( r - strictValue(i) != 0 ) {
pr(i,"r != 2^24",r);
}
}
}
}
========================================= retPar.trace
H:\ld32\inev\tmp\fp> H:\ld14\java\dest\jdk1.2fcsG\win32\bin\java retPar
i=(-1) halfUlp ; == 1.0141205E31 , 0x73000000
i=(32) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(32) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(33) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(33) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(35) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
i=(36) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(36) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(37) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(37) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(39) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
i=(40) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(40) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(41) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(41) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(43) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
i=(44) retPar(-Float.MAX_VALUE * 2) != Float.NEGATIVE_INFINITY ; == -Infinity , 0xff800000
i=(44) r != Float.NEGATIVE_INFINITY ; == -3.4028235E38 , 0xff7fffff
i=(45) retPar(Float.MAX_VALUE+halfUlp) != Float.POSITIVE_INFINITY ; == Infinity , 0x7f800000
i=(45) r != Float.POSITIVE_INFINITY ; == 1.0141205E31 , 0x73000000
i=(47) retPar(2^24-0.5) != 2^24 ; == 1.6777216E7 , 0x4b800000
H:\ld32\inev\tmp\fp> H:\ld14\java\dest\jdk1.2fcsG\win32\bin\java retPar
Warning: JIT compiler "inev" not found. Will use interpreter.
i=(-1) halfUlp ; == 1.0141205E31 , 0x73000000
- relates to
-
JDK-4181732 Regression test vm/misc/WideStrictInline.java refers to widefp
- Closed