never@1738: /* never@1738: * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. never@1738: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. never@1738: * never@1738: * This code is free software; you can redistribute it and/or modify it never@1738: * under the terms of the GNU General Public License version 2 only, as never@1738: * published by the Free Software Foundation. never@1738: * never@1738: * This code is distributed in the hope that it will be useful, but WITHOUT never@1738: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or never@1738: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License never@1738: * version 2 for more details (a copy is included in the LICENSE file that never@1738: * accompanied this code). never@1738: * never@1738: * You should have received a copy of the GNU General Public License version never@1738: * 2 along with this work; if not, write to the Free Software Foundation, never@1738: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. never@1738: * never@1738: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, never@1738: * CA 95054 USA or visit www.sun.com if you need additional information or never@1738: * have any questions. never@1738: * never@1738: */ never@1738: never@1738: /** never@1738: * @test never@1738: * @bug 6930043 never@1738: * @summary C2: SIGSEGV in javasoft.sqe.tests.lang.arr017.arr01702.arr01702.loop_forw(II)I never@1738: * never@1738: * @run main Test6930043 never@1738: */ never@1738: never@1738: import java.io.PrintStream; never@1738: never@1738: public class Test6930043 { never@1738: int[] a; never@1738: int idx; never@1738: never@1738: public int loop_back(int i, int i_0_) { never@1738: int i_1_ = 0; never@1738: int[] is = a; never@1738: if (is == null) return 0; never@1738: for (int i_2_ = i; i_2_ >= i_0_; i_2_--) never@1738: i_1_ += is[idx = i_2_]; never@1738: return i_1_; never@1738: } never@1738: never@1738: public int loop_forw(int start, int end) { never@1738: int result = 0; never@1738: int[] is = a; never@1738: if (is == null) return 0; never@1738: for (int index = start; index < end; index++) never@1738: result += is[index]; never@1738: // result += is[idx = index]; never@1738: return result; never@1738: } never@1738: never@1738: public static void main(String[] strings) { never@1738: Test6930043 var_Test6930043 = new Test6930043(); never@1738: var_Test6930043.a = new int[1000000]; never@1738: var_Test6930043.loop_forw(10, 999990); never@1738: var_Test6930043.loop_forw(10, 999990); never@1738: for (int i = 0; i < 3; i++) { never@1738: try { never@1738: if (var_Test6930043.loop_forw(-1, 999990) != 0) throw new InternalError(); never@1738: } catch (ArrayIndexOutOfBoundsException e) { } never@1738: } never@1738: var_Test6930043.loop_back(999990, 10); never@1738: var_Test6930043.loop_back(999990, 10); never@1738: for (int i = 0; i < 3; i++) { never@1738: try { never@1738: if (var_Test6930043.loop_back(999990, -1) != 0) throw new InternalError(); never@1738: } catch (ArrayIndexOutOfBoundsException e) { } never@1738: } never@1738: } never@1738: }