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