[llvm-bugs] [Bug 41485] New: StaticAnalyzer/Checkers/IteratorChecker.cpp:1037]: (error) Dead pointer usage

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 13 04:45:23 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41485

            Bug ID: 41485
           Summary: StaticAnalyzer/Checkers/IteratorChecker.cpp:1037]:
                    (error) Dead pointer usage
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dcb314 at hotmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:1037]: (error) Dead
pointer usage. Pointer 'value' is dead if it has been assigned '&val' at line
1032.

Source code is

  if (auto loc = RHS.getAs<Loc>()) {
    const auto val = State->getRawSVal(*loc);
    value = &val;
  }

  auto &TgtVal = (Op == OO_PlusEqual || Op == OO_MinusEqual) ? LHS : RetVal;
  State =
      setIteratorPosition(State, TgtVal, advancePosition(C, Op, *Pos, *value));

Suggest move local variable val out to wider scope.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190413/96334bc5/attachment.html>


More information about the llvm-bugs mailing list