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 2006/11/15 10:12:38 UTC
[jira] Updated: (HARMONY-2191) [drlvm] [jit] [opt] It is possible
to call an array element of multidimensional array with first 0-dimention
[ http://issues.apache.org/jira/browse/HARMONY-2191?page=all ]
Elena Sayapina updated HARMONY-2191:
------------------------------------
Attachment: MultiArr.java
Test MultiArr.java was attached.
> [drlvm] [jit] [opt] It is possible to call an array element of multidimensional array with first 0-dimention
> ------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-2191
> URL: http://issues.apache.org/jira/browse/HARMONY-2191
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Any
> Reporter: Elena Sayapina
> Attachments: MultiArr.java
>
>
> ArrayIndexOutOfBoundsException isn't thrown in some cases if call an array element of multidimensional array with first 0-dimention (for example, int
> arr[] = int[0][1]). It only happens in JIT server static mode, so suppose ABCD optimization incorrectly remove up bound check.
> Please, see the code example below.
> Code for reproducing:
> public class MultiArr {
> public static void main(String[] args) {
> System.exit(new MultiArr().test());
> }
>
> public int test() {
> System.out.println("Start MultiArr test...");
> try {
> check(new int[0][0], 2);
> System.out.println("TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown");
> return 1;
> } catch (ArrayIndexOutOfBoundsException e) {
> System.out.println("TEST PASSED: ArrayIndexOutOfBoundsException was thown");
> return 0;
> }
> }
>
> void check(int[][] array, int num) {
> boolean error = false;
> for (int i = num-1; i >= 0; i--) {
> if (error) return;
> if (i < num-1) {
> System.out.println("Call array[" + i + "][" + (i+1) + "]");
> error = true;
> array[i][i+1] = 0;
> }
> }
> }
> }
> NOTE: it is no matter write to an element array[0][1] or read the value of array[0][1] to some variable (for example, int var = array[0][1]).
> Steps to Reproduce:
> Compile and run MultiArr class 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 = r@svn.revision@, (Nov 14 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Start MultiArr test...
> Call array[0][1]
> TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown
> Output on Linux:
> 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 = r@svn.revision@, (Nov 14 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> Start MultiArr test...
> Call array[0][1]
> TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown
> Output on RI:
> Start MultiArr test...
> Call array[0][1]
> TEST PASSED: ArrayIndexOutOfBoundsException was thown
> Note: Test passes in JIT default mode
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira