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