never@504: /* kamg@612: * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved. kamg@612: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. never@504: * kamg@612: * This code is free software; you can redistribute it and/or modify it kamg@612: * under the terms of the GNU General Public License version 2 only, as kamg@612: * published by the Free Software Foundation. never@504: * kamg@612: * This code is distributed in the hope that it will be useful, but WITHOUT kamg@612: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or kamg@612: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License kamg@612: * version 2 for more details (a copy is included in the LICENSE file that kamg@612: * accompanied this code). never@504: * kamg@612: * You should have received a copy of the GNU General Public License version kamg@612: * 2 along with this work; if not, write to the Free Software Foundation, kamg@612: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. never@504: * kamg@612: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, kamg@612: * CA 95054 USA or visit www.sun.com if you need additional information or kamg@612: * have any questions. never@504: * never@504: */ never@504: never@504: /* never@504: * @test never@504: * @bug 6659207 never@504: * @summary access violation in CompilerThread0 never@504: */ never@504: never@504: public class Test { never@504: static int[] array = new int[12]; never@504: never@504: static int index(int i) { never@504: if (i == 0) return 0; never@504: for (int n = 0; n < array.length; n++) never@504: if (i < array[n]) return n; never@504: return -1; never@504: } never@504: never@504: static int test(int i) { never@504: int result = 0; never@504: i = index(i); never@504: if (i >= 0) never@504: if (array[i] != 0) never@504: result++; never@504: never@504: if (i != -1) never@504: array[i]++; never@504: never@504: return result; never@504: } never@504: never@504: public static void main(String[] args) { never@504: int total = 0; never@504: for (int i = 0; i < 100000; i++) { never@504: total += test(10); never@504: } never@504: System.out.println(total); never@504: } never@504: }