Details
-
Bug
-
Resolution: Fixed
-
P2
-
11.0.10, 13, 14, 15, 16, 17
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8262246 | 16.0.2 | Christoph Langer | P2 | Resolved | Fixed | b01 |
JDK-8262026 | 16.0.1 | Christoph Langer | P2 | Closed | Fixed | b06 |
JDK-8267373 | 15.0.4 | Ekaterina Vergizova | P2 | Resolved | Fixed | b03 |
JDK-8263792 | 13.0.7 | Ekaterina Vergizova | P2 | Resolved | Fixed | b04 |
JDK-8262169 | 11.0.11 | Pengfei Li | P2 | Resolved | Fixed | b04 |
Description
public class Bug {
private static int SIZE = 60000;
private static char[] a = new char[SIZE];
private static char[] b = new char[SIZE];
public static void main(String[] args) {
for (int i = 0; i < SIZE; i++) {
a[i] = b[i] = (char) i;
}
for (int i = 0; i < SIZE; i++) {
a[i] = (char) Math.abs(a[i]);
}
for (int i = 0; i < SIZE; i++) {
if (a[i] != b[i]) {
throw new RuntimeException("Broken!");
}
}
System.out.println("OK");
}
}
// $ java -Xint Bug
// OK
// $ java -Xcomp -XX:-TieredCompilation Bug
// Exception in thread "main" java.lang.RuntimeException: Broken!
// at Bug.main(Bug.java:15)
This may cause loss of data (although in few cases) so I would change the priority to P2.
Affect versions: 13, 14, 15, 16, 17 (both x86 and AArch64) and 11u (x86-only)
Attachments
Issue Links
- backported by
-
JDK-8262169 Fix incorrect result of Math.abs() with char type
-
- Resolved
-
-
JDK-8262246 Fix incorrect result of Math.abs() with char type
-
- Resolved
-
-
JDK-8263792 Fix incorrect result of Math.abs() with char type
-
- Resolved
-
-
JDK-8267373 Fix incorrect result of Math.abs() with char type
-
- Resolved
-
-
JDK-8262026 Fix incorrect result of Math.abs() with char type
-
- Closed
-
- relates to
-
JDK-8222074 Enhance auto vectorization for x86
-
- Resolved
-
-
JDK-8276673 Optimize abs operations in C2 compiler
-
- Resolved
-
- links to
-
Commit openjdk/jdk13u-dev/ff29b0b8
-
Commit openjdk/jdk15u-dev/2a1129e7
-
Commit openjdk/jdk16u/9d0adb8b
-
Commit openjdk/jdk/7a2db858
-
Review openjdk/jdk13u-dev/152
-
Review openjdk/jdk15u-dev/60
-
Review openjdk/jdk16u/34
-
Review openjdk/jdk/2419