1 /*
2  * Copyright (c) 2019, Huawei Technologies Co. Ltd. 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 8217359
27  * @summary C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
28  *
29  * @run main/othervm -XX:-TieredCompilation
30  *      -XX:CompileCommand=compileonly,compiler.c2.Test8217359::test
31  *      compiler.c2.Test8217359
32  */
33 
34 package compiler.c2;
35 
36 public class Test8217359 {
37 
38     public static int ival = 0;
39     public static long lsum = 0;
40     public static long lval = 0;
41 
test()42     public static void test() {
43         short s = -25632;
44         float f = 0.512F, f1 = 2.556F;
45         int i6 = 32547, i7 = 9, i8 = -9, i9 = 36, i10 = -223;
46 
47         for (i6 = 4; i6 < 182; i6++) {
48             i8 = 1;
49             while (++i8 < 17) {
50                 f1 = 1;
51                 do {
52                     i7 += (182 + (f1 * f1));
53                 } while (++f1 < 1);
54 
55                 Test8217359.ival += (i8 | Test8217359.ival);
56             }
57         }
58 
59         for (i9 = 9; i9 < 100; ++i9) {
60             i10 -= i6;
61             i10 >>= s;
62             i7 += (((i9 * i10) + i6) - Test8217359.lval);
63         }
64 
65         lsum += i6 + i7 + i8;
66     }
67 
main(String[] args)68     public static void main(String[] args) {
69         for (int i = 0; i < 16000; i++) {
70             test();
71         }
72     }
73 
74 }
75