1 /*
2  * Copyright (c) 2019, 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  * @test
26  * @bug 8210392
27  * @summary C2 Assert failure: Live node limit exceeded
28  *
29  * @run main/othervm compiler.loopopts.Test8210392
30  */
31 
32 package compiler.loopopts;
33 
34 public class Test8210392 {
35     public static int ival = 17;
36 
intFn()37     public static int intFn() {
38         int v = 0, k = 0;
39         for (int i = 17; i < 311; i += 3) {
40             v = Test8210392.ival;
41             int j = 1;
42             do {
43                 v *= i;
44                 v += j * v;
45                 while (++k < 1)
46                     ;
47             } while (++j < 13);
48         }
49         return v;
50     }
51 
mainTest()52     public void mainTest() {
53         for (int i = 0; i < 30000; i++) {
54             Test8210392.ival = intFn();
55         }
56     }
57 
main(String[] _args)58     public static void main(String[] _args) {
59         Test8210392 tc = new Test8210392();
60         for (int i = 0; i < 10; i++) {
61             tc.mainTest();
62         }
63     }
64 }
65 
66