-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
1.1.2
-
x86
-
windows_nt
Name: laC46010 Date: 05/18/97
JIT 210.046 for JDK 1.1.2 doesn't execute some expression operators
particularly various assignment operators when they are executed before
other operator completed abruptly.
In the following example (extracted from JCK's expr17201 test case)
containing expression
i = (a = b)[i++];
it looks like operator [] is executed before ++ operator
and consecuently "i" variable is not changed accordingly
before NullPointerException thrown and caught. See log:
[H:/ld12/java/leo/java/bug/jit/expr] jc -d . expr17201.java
Symantec Java! JustInTime Compiler Version 210.046 for JDK 1.1.2
Copyright (C) 1996-97 Symantec Corporation
[H:/ld12/java/leo/java/bug/jit/expr] ja -verify expr17201
Symantec Java! JustInTime Compiler Version 210.046 for JDK 1.1.2
Copyright (C) 1996-97 Symantec Corporation
Failed.
i=1
a=null
"i" value should be equal to "2" here.
If we change "i = (a = b)[i++]" to "i = (a = b)[2 + i++]"
then "i" value is even more strange and equal to "3":
[H:/ld12/java/leo/java/bug/jit/expr] jc -d . expr17201.java
Symantec Java! JustInTime Compiler Version 210.046 for JDK 1.1.2
Copyright (C) 1996-97 Symantec Corporation
[H:/ld12/java/leo/java/bug/jit/expr] ja -verify expr17201
Symantec Java! JustInTime Compiler Version 210.046 for JDK 1.1.2
Copyright (C) 1996-97 Symantec Corporation
Failed.
i=3
a=null
---------------------------------------------------------
// Ident: @(#)expr17201.java 1.1 96/12/10
// Copyright 12/10/96 Sun Microsystems, Inc. All Rights Reserved
// package javasoft.sqe.tests.lang.expr172.expr17201;
import java.io.PrintStream;
import java.lang.NullPointerException;
public class expr17201
{
public static void main(String args[])
{
System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String args[], PrintStream out)
{
int [] a = {0, 11, 22, 33, 44}, b = null;
int i = 1;
try {
i = (a = b)[i++];
// i = (a = b)[2 + i++];
} catch (NullPointerException e) {
if (a == null && i == 2) {
out.println("Passed.");
out.println("i=" + i);
out.println("a=" + a);
return 0;
}
}
out.println("Failed.");
out.println("i=" + i);
out.println("a=" + a);
return 2;
}
}
---------------------------------------------------------
This bug probably causes failures of other JCK111a tests listed below:
lang/EXPR/expr471/expr47101 res = (a[i] = 1); res assigned before IndexOutOfBoundsException
lang/EXPR/expr491/expr49101 res = (a[0] += ++i); res assigned before NullPointerException
lang/EXPR/expr491/expr49102 res = (a[i] += ++j); res assigned before IndexOutOfBoundsException
lang/STMT/stmt028/stmt02802 wrong a1 value after a1=3; a1 = 10/(a2-5); a1==0 after exception thrown
lang/EXPR/expr031/expr03101 i = (i / zero) * (j = square(i - 2) + --i); j assigned before ArithmeticException
lang/EXPR/expr040/expr04001 x = new Triple(i++ / zero, j += i, k *= i + j); x is assigned before exception thrown
lang/EXPR/expr027/expr02701 y = (i *= power(i, 2)) + (j -= (int) (x-- / power(j, j))) + x--; x has not been decreased before exception thrown from power()
lang/EXPR/expr062/expr06201 x = new Triple [i++ / zero][j += i][k *= i + j]; i is not increased x = new Triple [i--][j += maxRmd(i, j, k - 3)][k *= j];
lang/EXPR/expr115/expr11501 x = new expr11501(0)).setVal(++val)
lang/EXPR/expr115/expr11502 (x = new expr11502(0)).modVal(++x.val)
lang/EXPR/expr164/expr16401 j = a[a.length / i][++i]; ++ is executed before /
lang/STMT/stmt072/stmt07201 for ( i1 = 1, i2 = 1, i3 = 1; i1 < 5; i1++, i2+=(10/(2-a1)), i3++ )
lang/STMT/stmt072/stmt07202 for ( i1 = 1, i2 = 1, i3 = 1; ; i1++, i2+=(10/(2-a1)), i3++ )
======================================================================