test/hotspot/jtreg/compiler/c2/Test8217359.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 53449 ea002b56e2f3
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53449
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     1
/*
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     2
 * Copyright (c) 2019, Huawei Technologies Co. Ltd. All rights reserved.
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     4
 *
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     8
 *
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    13
 * accompanied this code).
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    14
 *
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    18
 *
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    21
 * questions.
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    22
 */
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    23
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    24
/**
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    25
 * @test
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    26
 * @bug 8217359
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    27
 * @summary C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    28
 *
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    29
 * @run main/othervm -XX:-TieredCompilation
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    30
 *      -XX:CompileCommand=compileonly,compiler.c2.Test8217359::test
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    31
 *      compiler.c2.Test8217359
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    32
 */
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    33
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    34
package compiler.c2;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    35
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    36
public class Test8217359 {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    37
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    38
    public static int ival = 0;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    39
    public static long lsum = 0;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    40
    public static long lval = 0;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    41
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    42
    public static void test() {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    43
        short s = -25632;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    44
        float f = 0.512F, f1 = 2.556F;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    45
        int i6 = 32547, i7 = 9, i8 = -9, i9 = 36, i10 = -223;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    46
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    47
        for (i6 = 4; i6 < 182; i6++) {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    48
            i8 = 1;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    49
            while (++i8 < 17) {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    50
                f1 = 1;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    51
                do {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    52
                    i7 += (182 + (f1 * f1));
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    53
                } while (++f1 < 1);
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    54
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    55
                Test8217359.ival += (i8 | Test8217359.ival);
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    56
            }
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    57
        }
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    58
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    59
        for (i9 = 9; i9 < 100; ++i9) {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    60
            i10 -= i6;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    61
            i10 >>= s;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    62
            i7 += (((i9 * i10) + i6) - Test8217359.lval);
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    63
        }
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    64
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    65
        lsum += i6 + i7 + i8;
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    66
    }
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    67
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    68
    public static void main(String[] args) {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    69
        for (int i = 0; i < 16000; i++) {
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    70
            test();
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    71
        }
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    72
    }
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    73
ea002b56e2f3 8217359: C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
fyang
parents:
diff changeset
    74
}