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

C2: Uninitialized VLoop::_pre_loop_end after JDK-8324890

XMLWordPrintable

    • b13

      JDK-8324890 refactored `_pre_loop_end` field from `CountedLoopNode` to `VLoop`, but missed moving the initialization from relevant constructor:
       https://github.com/openjdk/jdk/commit/232d13688596e9a3c1145ee456dd5a6f7cd1223d#diff-03984204866fcf34c14cb3e5b8ad40348cd60f31af7c937ce6ef7b84e8ea1c69L241

      SonarCloud now complains about that field in VLoop:
       1 uninitialized field at the end of the constructor call

      The bug looks innocuous so far, but it would potentially skip the assert and return garbage here:

      ```
        CountedLoopEndNode* pre_loop_end() const {
          assert(cl()->is_main_loop(), "only main loop can reference pre-loop");
          assert(_pre_loop_end != nullptr, "must have found it");
          return _pre_loop_end;
        };
      ```

            jcao Joshua Cao
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: