JDK-8160363 : assert(discovered->is_oop_or_null()) failed: Expected an oop or NULL for discovered field at 0x0000000000000000
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2016-06-27
  • Updated: 2016-08-23
  • Resolved: 2016-07-30
Related Reports
Duplicate :  
Description
This crash occurred in fastdebug JVM which was built by GCC 6.
Address of pointer was expected (0x0), however is_oop_or_null() did not work.

I do not understand why current code did not work, however it works fine as below:

-------------------------
--- old/src/share/vm/oops/oop.inline.hpp        2016-06-27 12:31:51.062240003 +0900
+++ new/src/share/vm/oops/oop.inline.hpp        2016-06-27 12:31:50.922240253 +0900
@@ -539,7 +539,7 @@

 // used only for asserts
 bool oopDesc::is_oop_or_null(bool ignore_mark_word) const {
-  return this == NULL ? true : is_oop(ignore_mark_word);
+  return (this == NULL) || is_oop(ignore_mark_word);
 }

 #ifndef PRODUCT
-------------------------

Comments
Since (this == NULL) involves undefined behavior, the compiler might do more or less anything, and might do different things on different days or with otherwise very similar code.
30-07-2016