<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - HexagonOptAddrMode::changeStore - null dereference warning"
   href="https://bugs.llvm.org/show_bug.cgi?id=43463">43463</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>HexagonOptAddrMode::changeStore - null dereference warning
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: Hexagon
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>eugene.zelenko@gmail.com, kparzysz@quicinc.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://llvm.org/reports/scan-build/report-HexagonOptAddrMode.cpp-add-1-1.html#EndPath">https://llvm.org/reports/scan-build/report-HexagonOptAddrMode.cpp-add-1-1.html#EndPath</a>

MachineInstrBuilder MIB;
if (ImmOpNum == 0) {
  if (HII->getAddrMode(*OldMI) == HexagonII::BaseRegOffset) {
    short NewOpCode = HII->changeAddrMode_rr_ur(*OldMI);
    assert(NewOpCode >= 0 && "Invalid New opcode\n");
    MIB = BuildMI(*BB, InsertPt, OldMI->getDebugLoc(), HII->get(NewOpCode));
    MIB.add(OldMI->getOperand(1));
    MIB.add(OldMI->getOperand(2));
    MIB.add(ImmOp);
    MIB.add(OldMI->getOperand(3));
    OpStart = 4;
  } else if (HII->getAddrMode(*OldMI) == HexagonII::BaseImmOffset) {
    short NewOpCode = HII->changeAddrMode_io_abs(*OldMI);
    assert(NewOpCode >= 0 && "Invalid New opcode\n");
    MIB = BuildMI(*BB, InsertPt, OldMI->getDebugLoc(), HII->get(NewOpCode));
    const GlobalValue *GV = ImmOp.getGlobal();
    int64_t Offset = ImmOp.getOffset() + OldMI->getOperand(1).getImm();
    MIB.addGlobalAddress(GV, Offset, ImmOp.getTargetFlags());
    MIB.add(OldMI->getOperand(2));
    OpStart = 3;
  }
  Changed = true;
  LLVM_DEBUG(dbgs() << "[Changing]: " << *OldMI << "\n");
  LLVM_DEBUG(dbgs() << "[TO]: " << *MIB << "\n");
}

clang static analyzer is warning that Changed could be set to true even if the
MI builder is still empty (null). Should the Changed = true be put inside both
the if/else cases?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>