1 /* 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 /** 26 * @test 27 * @bug 7024475 28 * @summary loop doesn't terminate when compiled 29 * 30 * @run main compiler.c2.Test7024475 31 */ 32 33 package compiler.c2; 34 35 public class Test7024475 { 36 37 static int i; 38 static int x1; 39 static int[] bucket_B; 40 41 static void test(Test7024475 test, int i, int c0, int j, int c1) { 42 for (;;) { 43 if (c1 > c0) { 44 if (c0 > 253) { 45 throw new InternalError("c0 = " + c0); 46 } 47 int index = c0 * 256 + c1; 48 if (index == -1) return; 49 i = bucket_B[index]; 50 if (1 < j - i && test != null) 51 x1 = 0; 52 j = i; 53 c1--; 54 } else { 55 c0--; 56 if (j <= 0) 57 break; 58 c1 = 255; 59 } 60 } 61 } 62 63 public static void main(String args[]) { 64 Test7024475 t = new Test7024475(); 65 bucket_B = new int[256*256]; 66 for (int i = 1; i < 256*256; i++) { 67 bucket_B[i] = 1; 68 } 69 for (int n = 0; n < 100000; n++) { 70 test(t, 2, 85, 1, 134); 71 } 72 } 73 }