annotate test/compiler/7024475/Test7024475.java @ 2403:1927db75dd85

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