test/hotspot/jtreg/compiler/c2/Test7174363.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 47216 71c04702a3d5
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:
13105
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     1
/*
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     4
 *
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     8
 *
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    13
 * accompanied this code).
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    14
 *
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    18
 *
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    21
 * questions.
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    22
 */
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    23
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    24
/**
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    25
 * @test
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    26
 * @bug 7174363
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    27
 * @summary crash with Arrays.copyOfRange(original, from, to) when from > original.length
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    29
 * @run main/othervm -XX:-BackgroundCompilation compiler.c2.Test7174363
13105
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    30
 */
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    31
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    32
package compiler.c2;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    33
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    34
import java.util.Arrays;
13105
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    35
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    36
public class Test7174363 {
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    37
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    38
  static Object[] m(Object[] original, int from, int to) {
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    39
    return Arrays.copyOfRange(original, from, to, Object[].class);
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    40
  }
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    41
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    42
  static public void main(String[] args) {
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    43
    Object[] orig = new Object[10];
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    44
    for (int i = 0; i < 20000; i++) {
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    45
      try {
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    46
        m(orig, 15, 20);
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    47
      } catch (ArrayIndexOutOfBoundsException excp) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    48
      }
13105
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    49
    }
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    50
  }
68f3bf10f08e 7174363: Arrays.copyOfRange leads to VM crash with -Xcomp -server if executed by testing framework
roland
parents:
diff changeset
    51
}