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

G1: "yielded" is not initialized on some paths after JDK-8140326

XMLWordPrintable

    • gc
    • b12

      SonarCloud has a new warning after JDK-8140326:

      ```
              bool yielded;
              bool mark_aborted = yield_if_necessary(yielded);
              if (mark_aborted) {
      ...
              } else if (yielded && !should_rebuild_or_scrub(hr)) { // <--- Branch condition evaluates to a garbage value
      ...
              }
      ```

      This warning is about `yielded` being not initialized on some paths, reading the garbage value from it on branch checks.

      There are other uses of `yield_if_necessary`, and at some uses we initialize `yielded = true`. This seems a bit awkward in itself: we are assuming the yield happened even without checking it in yield_if_necessary. It is therefore unclear what should be the default value in other cases.

            tschatzl Thomas Schatzl
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: