./test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java has supporting native code in libTestDwarf.c and libTestDwarfHelper.h.
There are several problems with this native code.
dereference_null() in libTestDwarfHelper.h contains a store to a null pointer. (So poorly named, since it's not a dereference at all.) The compiler can easily detect this undefined behavior. clang optimizes the assignment away. This results in the test failing for clang/linux, because the expected crash didn't occur.
There are several divisions by zero in libTestDwarf.c. The compiler can easily detect this undefined behavior.
There is a helper function, foo, in libTestDwarf.c. There are comments suggesting it needs to be not inlined, and it is made "big enough ... that it is not inlined". But that's hardly reliable.
There are several problems with this native code.
dereference_null() in libTestDwarfHelper.h contains a store to a null pointer. (So poorly named, since it's not a dereference at all.) The compiler can easily detect this undefined behavior. clang optimizes the assignment away. This results in the test failing for clang/linux, because the expected crash didn't occur.
There are several divisions by zero in libTestDwarf.c. The compiler can easily detect this undefined behavior.
There is a helper function, foo, in libTestDwarf.c. There are comments suggesting it needs to be not inlined, and it is made "big enough ... that it is not inlined". But that's hardly reliable.