diff --git a/src/hotspot/share/runtime/frame.cpp b/src/hotspot/share/runtime/frame.cpp index b80aa8c4457f6..76ac1d77422cf 100644 --- a/src/hotspot/share/runtime/frame.cpp +++ b/src/hotspot/share/runtime/frame.cpp @@ -1163,8 +1163,7 @@ void frame::oops_do_internal(OopClosure* f, NMethodClosure* cf, #ifndef PRODUCT // simulate GC crash here to dump java thread in error report if (CrashGCForDumpingJavaThread) { - volatile char *t = nullptr; // Use volatile to prevent compiler from optimising away the store - *t = 'c'; + guarantee(!CrashGCForDumpingJavaThread, ""); } #endif if (is_interpreted_frame()) {