-
Bug
-
Resolution: Fixed
-
P2
-
9
-
b173
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8182247 | 10 | Roland Westrelin | P2 | Resolved | Fixed | b12 |
JDK-8181680 | 9.0.4 | Roland Westrelin | P2 | Resolved | Fixed | b01 |
public class TestACSameSrcDst {
static int test1(int[] src, int[] dst) {
System.arraycopy(src, 5, dst, 0, 10);
return dst[0];
}
static int test2(int[] src) {
System.arraycopy(src, 0, src, 0, 10);
return src[0];
}
public static void main(String[] args) {
int[] array = new int[15];
for (int i = 0; i < 20000; i++) {
for (int j = 0; j < array.length; j++) {
array[j] = j;
}
int expected = array[5];
int res = test1(array, array);
if (res != expected) {
throw new RuntimeException("bad result: " + res + " != " + expected);
}
test2(array);
}
}
}
test1() above causes an incorrect execution. test2() causes an infinite loop in GVN:
# Internal Error (/home/roland/hs/hotspot/src/share/vm/opto/phaseX.cpp:791), pid=6855, tid=6892
# assert(loop_count++ < K) failed: infinite loop in PhaseGVN::transform
Both are caused by LoadNode::can_see_arraycopy_value()
static int test1(int[] src, int[] dst) {
System.arraycopy(src, 5, dst, 0, 10);
return dst[0];
}
static int test2(int[] src) {
System.arraycopy(src, 0, src, 0, 10);
return src[0];
}
public static void main(String[] args) {
int[] array = new int[15];
for (int i = 0; i < 20000; i++) {
for (int j = 0; j < array.length; j++) {
array[j] = j;
}
int expected = array[5];
int res = test1(array, array);
if (res != expected) {
throw new RuntimeException("bad result: " + res + " != " + expected);
}
test2(array);
}
}
}
test1() above causes an incorrect execution. test2() causes an infinite loop in GVN:
# Internal Error (/home/roland/hs/hotspot/src/share/vm/opto/phaseX.cpp:791), pid=6855, tid=6892
# assert(loop_count++ < K) failed: infinite loop in PhaseGVN::transform
Both are caused by LoadNode::can_see_arraycopy_value()
- backported by
-
JDK-8181680 ArrayCopy with same src and dst can cause incorrect execution or compiler crash
-
- Resolved
-
-
JDK-8182247 ArrayCopy with same src and dst can cause incorrect execution or compiler crash
-
- Resolved
-
- relates to
-
JDK-8076188 Optimize arraycopy out for non escaping destination
-
- Resolved
-
-
JDK-8181742 Load that bypasses arraycopy has wrong memory state
-
- Closed
-