When running tests/isolated/FieldReflection.java on macOS, the program sometimes crashes due to a segfault. It is caused by fld.get(aaa) where fld is static Integer b and aaa is a FieldReflection object. Note that this bug happens non-deterministically (it did not happen most of the times) and it cannot be reproduced on linux. The stdout and stack backtrace are shown below.
stdout:
class java.lang.Long
class java.lang.Short
31
Chr
1
class java.lang.Character
a
class java.lang.Character
L
1
class java.lang.Long
null
class java.lang.Long
a
1
Process 20324 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x0000000100144d6b libjvm.dylib`jlang.runtime.Helper#toString(java.lang.Object) at Helper.java:13
10 // If o or o.toString() are null, we must substitute "null".
11 static String toString(Object o) {
12 if (o == null) return "null";
-> 13 String res = o.toString();
14 return res == null ? "null" : res;
15 }
16
Target 0: (FieldReflection.o) stopped.
stack backtrace
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x0000000100144d6b libjvm.dylib`jlang.runtime.Helper#toString(java.lang.Object) at Helper.java:13
frame #1: 0x00000001008f7764 libjdk.dylib`java.lang.Class#toString() at Class.java:149
frame #2: 0x000000010091bd41 libjdk.dylib`java.lang.String#valueOf(java.lang.Object) at String.java:2854
frame #3: 0x000000010080afa2 libjdk.dylib`java.io.PrintStream#println(java.lang.Object) at PrintStream.java:821
frame #4: 0x000000010000147a FieldReflection.o`FieldReflection#main(java.lang.String[]) at FieldReflection.java:54
frame #5: 0x0000000100002926 FieldReflection.o`Java_entry_point + 22
frame #6: 0x0000000100144c07 libjvm.dylib`jlang.runtime.MainWrapper#main(java.lang.String[]) at MainWrapper.java:11
frame #7: 0x0000000100144cb4 libjvm.dylib`jlang.runtime.MainWrapper#runMain(java.lang.String[]) at MainWrapper.java:15
frame #8: 0x000000010015c963 libjvm.dylib`main(argc=0, argv=0x00007ffeefbff5c0) at main.cpp:65
frame #9: 0x00007fff5c363ed9 libdyld.dylib`start + 1
frame #10: 0x00007fff5c363ed9 libdyld.dylib`start + 1
When running tests/isolated/FieldReflection.java on macOS, the program sometimes crashes due to a segfault. It is caused by
fld.get(aaa)
wherefld
isstatic Integer b
andaaa
is aFieldReflection
object. Note that this bug happens non-deterministically (it did not happen most of the times) and it cannot be reproduced on linux. The stdout and stack backtrace are shown below.stdout:
stack backtrace
This bug can be reproduced on