Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 99314 invoked from network); 28 Nov 2006 15:29:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Nov 2006 15:29:56 -0000 Received: (qmail 91554 invoked by uid 500); 28 Nov 2006 15:29:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 91525 invoked by uid 500); 28 Nov 2006 15:29:54 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 91452 invoked by uid 99); 28 Nov 2006 15:29:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Nov 2006 07:29:53 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Nov 2006 07:29:43 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5B8547142F5 for ; Tue, 28 Nov 2006 07:29:23 -0800 (PST) Message-ID: <16727567.1164727763372.JavaMail.jira@brutus> Date: Tue, 28 Nov 2006 07:29:23 -0800 (PST) From: "Gregory Shimansky (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-2144) [drlvm][jit][opt] ABCD causes unexpected NullPointerException instead of ArrayIndexOutOfBoundsException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-2144?page=all ] Gregory Shimansky updated HARMONY-2144: --------------------------------------- Summary: [drlvm][jit][opt] ABCD causes unexpected NullPointerException instead of ArrayIndexOutOfBoundsException (was: [drlvm] [jit] [opt] ABCD causes unexpected NullPointerException instead of ArrayIndexOutOfBoundsException) > [drlvm][jit][opt] ABCD causes unexpected NullPointerException instead of ArrayIndexOutOfBoundsException > ------------------------------------------------------------------------------------------------------- > > Key: HARMONY-2144 > URL: http://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 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. - 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