8176505: Wrong assertion 'should be an array copy/clone' in arraycopynode.cpp

Reviewed-by: thartmann, roland
This commit is contained in:
Volker Simonis 2017-03-13 16:07:17 +01:00
parent 56f838f4ee
commit 1cd78903a8
2 changed files with 52 additions and 2 deletions

View File

@ -225,7 +225,6 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
Node* dest = in(ArrayCopyNode::Dest);
const Type* src_type = phase->type(src);
const TypeAryPtr* ary_src = src_type->isa_aryptr();
assert(ary_src != NULL, "should be an array copy/clone");
if (is_arraycopy() || is_copyofrange() || is_copyof()) {
const Type* dest_type = phase->type(dest);
@ -286,7 +285,8 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
copy_type = dest_elem;
} else {
assert (is_clonebasic(), "should be");
assert(ary_src != NULL, "should be a clone");
assert(is_clonebasic(), "should be");
disjoint_bases = true;
assert(src->is_AddP(), "should be base + off");

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2017, SAP SE and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8176505
* @summary Wrong assertion 'should be an array copy/clone' in arraycopynode.cpp
*
* @run main/othervm -Xbatch -XX:-UseOnStackReplacement compiler.arraycopy.TestObjectArrayCopy
*
* @author Volker Simonis
*/
package compiler.arraycopy;
public class TestObjectArrayCopy {
public static boolean crash(Object src) {
String[] dst = new String[1];
System.arraycopy(src, 0, dst, 0, 1);
return dst[0] == null;
}
public static void main(String[] args) {
String[] sa = new String[1];
for (int i = 0; i < 20_000; i++) {
crash(sa);
}
}
}