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

C1: LoopInvariantCodeMotion constructor can leave some fields uninitialized

    XMLWordPrintable

Details

    • b19

    Backports

      Description

        SonarCloud instance reports the following problem:
          3 uninitialized fields at the end of the constructor call

        class LoopInvariantCodeMotion : public StackObj {
         private:
          GlobalValueNumbering* _gvn;
          ShortLoopOptimizer* _short_loop_optimizer;
          Instruction* _insertion_point; // <---- left uninitialized after shortcut
          ValueStack * _state; // <---- left uninitialized after shortcut
          bool _insert_is_pred; // <---- left uninitialized after shortcut

        LoopInvariantCodeMotion::LoopInvariantCodeMotion(ShortLoopOptimizer *slo, GlobalValueNumbering* gvn, BlockBegin* loop_header, BlockList* loop_blocks)
          : _gvn(gvn), _short_loop_optimizer(slo) {
         ...
          BlockBegin* insertion_block = loop_header->dominator();
          if (insertion_block->number_of_preds() == 0) {
            return; // <--- shortcut from constructor
          }

        Attachments

          Issue Links

            Activity

              People

                rbackman Rickard Backman (Inactive)
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: