Mark assertion failures noreturn

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: 21
    • Component/s: hotspot
    • b13

      HotSpot assertion failures and similar operations should have the reporting function called in the failure case marked with attribute `[[noreturn]]`.

      This may permit the compiler to generate better code in some cases. This matters even for production, since some of the operations (such as `guarantee` and `ShouldNotReachHere`) are present in product builds, not just debug builds.

      This also addresses the problems encountered in JDK-8294031. Because the failure reporting function used by assert is not "noreturn", the compiler is analyzing the continuation from a failed assert as potentially having the values that would result in an assertion failure (in this case, a variable having a null value). Doing so, it discovers a use of that variable in a context where a null value is UB, and so issues a warning.

      Of course, marking these functions noreturn will require actually making them not return. That's going to require some significant changes.

            Assignee:
            Kim Barrett
            Reporter:
            Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: