3461N/A/*
3461N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3461N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3461N/A *
3461N/A * This code is free software; you can redistribute it and/or modify it
3461N/A * under the terms of the GNU General Public License version 2 only, as
3461N/A * published by the Free Software Foundation.
3461N/A *
3461N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3461N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3461N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3461N/A * version 2 for more details (a copy is included in the LICENSE file that
3461N/A * accompanied this code).
3461N/A *
3461N/A * You should have received a copy of the GNU General Public License version
3461N/A * 2 along with this work; if not, write to the Free Software Foundation,
3461N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3461N/A *
3461N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3461N/A * or visit www.oracle.com if you need additional information or have any
3461N/A * questions.
3461N/A *
3461N/A */
3461N/A
3461N/A/**
3461N/A * @test
3461N/A * @bug 7174363
3461N/A * @summary crash with Arrays.copyOfRange(original, from, to) when from > original.length
3461N/A *
3461N/A * @run main/othervm -XX:-BackgroundCompilation Test7174363
3461N/A */
3461N/A
3461N/Aimport java.util.*;
3461N/A
3461N/Apublic class Test7174363 {
3461N/A
3461N/A static Object[] m(Object[] original, int from, int to) {
3461N/A return Arrays.copyOfRange(original, from, to, Object[].class);
3461N/A }
3461N/A
3461N/A static public void main(String[] args) {
3461N/A Object[] orig = new Object[10];
3461N/A for (int i = 0; i < 20000; i++) {
3461N/A try {
3461N/A m(orig, 15, 20);
3461N/A } catch(ArrayIndexOutOfBoundsException excp) {}
3461N/A }
3461N/A }
3461N/A}