You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Pavel Ozhdikhin (JIRA)" <ji...@apache.org> on 2007/06/05 14:21:26 UTC

[jira] Commented: (HARMONY-2141) [drlvm][jit][opt] ABCD removes low bound check if certain constraint exists before array access with a negative index

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

Pavel Ozhdikhin commented on HARMONY-2141:
------------------------------------------

The fix was committed as part of HARMONY-1788.

Elena, couls you please verify that the problem is not reproducible any more?

> [drlvm][jit][opt] ABCD removes low bound check if certain constraint exists before array access with a negative index
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2141
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2141
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Any
>            Reporter: Elena Sayapina
>         Attachments: abcdTest.java
>
>
> ABCD  optimization removes low bound check if certain constraint exists before array access with a negative index.
> ArrayIndexOutOfBoundsException must be thrown if array alement with negative index is accessed. 
> But harmony doesn't throw the Exception if abcd pass is turned on in the following case:
> Array elements are accessed inside a loop and array index depends on the loop control variable.
> A call to an array element with negative index occurred if
> control loop variable satisfies some linear constraint.
> Please, see the code example below.
> Code for reproducing:
> public class abcdTest {
>     public static void main(String[] args) {
>         System.out.println("Start Test ...");
>         int i = 0;
>         int arr[] = new int[300000];
>         try {
>             for(i=0; i<100000; i++) {
>                 while(i<3) {
>                     arr[i-1] = 1;
>                     i++;
>                 }
>             }
>             System.out.println("TEST 1 FAILED: " +
>                 "ArrayIndexOutOfBoundsException wasn't thrown");
>         } catch (ArrayIndexOutOfBoundsException ae) {
>             System.out.println("TEST 1 PASSED");
>         }
>         i = 0;
>         try {
>             for(i=0; i<100000; i++) {
>                 if (i>5) {
>                     arr[i-100] = 1;
>                     i++;
>                 }
>             }
>             System.out.println("TEST 2 FAILED: " +
>                 "ArrayIndexOutOfBoundsException wasn't thrown");
>         } catch (ArrayIndexOutOfBoundsException ae) {
>             System.out.println("TEST 2 PASSED");
>         }
>     }
> }
> Steps to Reproduce:
> Compile abcdTest class and run it on harmony with '-Xem:server_static'.
> Note:
> If remove loop variable constraints 'while(i<3)' , 'if(i>5)' in test1, test2 correspondingly, then abcdTest passes.
> Windows output:
> 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 Test ...
> TEST 1 FAILED: ArrayIndexOutOfBoundsException wasn't thrown
> TEST 2 FAILED: ArrayIndexOutOfBoundsException wasn't thrown
> Linux output:
> 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 Test ...
> TEST 1 FAILED: ArrayIndexOutOfBoundsException wasn't thrown
> TEST 2 FAILED: ArrayIndexOutOfBoundsException wasn't thrown
> Output on RI:
> Start Test ...
> TEST 1 PASSED
> TEST 2 PASSED

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.