harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuri Dolgov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2191) [drlvm][jit][opt] It is possible to call an array element of multidimensional array with first 0-dimention
Date Tue, 09 Oct 2007 07:20:51 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533290
] 

Yuri Dolgov commented on HARMONY-2191:
--------------------------------------

This issue is not reproducible on Harmony: svn = r579550, (Oct  8 2007), Windows/ia32/msvc
1310

> [drlvm][jit][opt] It is possible to call an array element of multidimensional array with
first 0-dimention
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2191
>                 URL: https://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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message