UnifiedOop invokes undefined behavior

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • 14
    • Affects Version/s: 14
    • Component/s: hotspot
    • jfr

      UnifiedOop may attempt to construct oop* values that are misaligned. That has unspecified behavior. Any further manipulation of the value (such as attempting to convert back to a narrowOop*) can't remove that. And dereferencing a pointer with unspecified value is undefined behavior.

      It is generally a bad idea to lie to the type system the way this class is doing. An alternative would be to have a distinct type that carried around the internal (tagged) pointer as a void* or the like. Make it a thin, trivially copyable class, and there's no additional overhead.

            Assignee:
            Markus Grönlund
            Reporter:
            Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: