You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Elena Sayapina (JIRA)" <ji...@apache.org> on 2007/06/06 10:01:40 UTC
[jira] Closed: (HARMONY-2144) [drlvm][jit][opt] ABCD causes
unexpected NullPointerException instead of ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/HARMONY-2144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Elena Sayapina closed HARMONY-2144.
-----------------------------------
Resolution: Fixed
Verified.
abcdTest2 from this bug and corresponding test org.apache.harmony.test.func.jit.HLO.abcd.Test4.Test4
from functional test suite (https://issues.apache.org/jira/browse/HARMONY-3528) passed on Harmony-r544727
with -Xem:opt, -Xem:server_static.
> [drlvm][jit][opt] ABCD causes unexpected NullPointerException instead of ArrayIndexOutOfBoundsException
> -------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2144
> URL: https://issues.apache.org/jira/browse/HARMONY-2144
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Any
> Reporter: Elena Sayapina
> Attachments: abcdTest2.java
>
>
> ABCD causes unexpected NullPointerException instead of ArrayIndexOutOfBoundsException.
> Consider that index of array element called inside a loop depends on the loop control variable.
> An overflow occurs on some loop iteration and corrupts the value of loop control variable so that it became negative.
> An array tries to be accessed with an illegal negative index.
> ArrayIndexOutOfBoundsException should be thrown in this case, but if abcd pass is turned on it causes unexpected NullPointerException.
> Please, see the code example below.
> Code for reproducing:
> public class abcdTest2 {
> private final int limit = 10000;
> public static void main(String[] args) {
> System.exit(new abcdTest2().test());
> }
> public int test() {
> System.out.println("Start abcdTest2 ...");
> int arr[] = new int[limit];
> int j=1;
> try {
> for(int k=2; k<limit; k=1+k+k*j) {
> if (k<0) System.out.println("---Overflow---");
> System.out.println("k=" + k + ": arr[" + (k-2) + "] will be called");
> arr[k] = arr[k-2];
> j = k*k;
> }
> } catch (ArrayIndexOutOfBoundsException e) {
> System.out.println("TEST PASSED ArrayIndexOutOfBoundsException was thrown");
> return 0;
> } catch (Exception e) {
> e.printStackTrace();
> System.out.println("TEST FAILED: unexpected exeption was thrown");
> return 1;
> }
> System.out.println("TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown");
> return 1;
> }
> }
> Steps to Reproduce:
> Compile abcdTest2 class and run it on Harmony with '-Xem:server_static' option.
> Output on Windows:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r473012, (Nov 10 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Start abcdTest2 ...
> k=2: arr[0] will be called
> k=11: arr[9] will be called
> k=1343: arr[1341] will be called
> ---Overflow---
> k=-1872665345: arr[-1872665347] will be called
> java.lang.NullPointerException
> at abcdTest2.test(abcdTest2.java)
> at abcdTest2.main(abcdTest2.java:6)
> TEST FAILED: unexpected exception was thrown
> Output on Linux:
> x_ia32_0002_icc_r_H/bin/java -showversion -Xem:server_static abcdTest2
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r473012, (Nov 10 2006), Linux/ia32/icc 900, release build
> http://incubator.apache.org/harmony
> Start abcdTest2 ...
> k=2: arr[0] will be called
> k=11: arr[9] will be called
> k=1343: arr[1341] will be called
> ---Overflow---
> k=-1872665345: arr[-1872665347] will be called
> java.lang.NullPointerException
> at abcdTest2.test(abcdTest2.java)
> at abcdTest2.main(abcdTest2.java:6)
> TEST FAILED: unexpected exception was thrown
> Output on RI:
> Start abcdTest2 ...
> k=2: arr[0] will be called
> k=11: arr[9] will be called
> k=1343: arr[1341] will be called
> ---Overflow---
> k=-1872665345: arr[-1872665347] will be called
> TEST PASSED ArrayIndexOutOfBoundsException was thrown
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.