Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8302189

Mark assertion failures noreturn

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 21
    • 21
    • hotspot
    • b13

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: