[llvm-bugs] [Bug 43536] New: Static analyzer isa and dyn_cast mismatch for the same pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 2 05:26:45 PDT 2019


            Bug ID: 43536
           Summary: Static analyzer isa and dyn_cast mismatch for the same
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: llvm-dev at redking.me.uk
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org,
                    noqnoqneo at gmail.com


const SCEV *IndexedReference::getLastCoefficient() const {
  const SCEV *LastSubscript = getLastSubscript();
  assert(isa<SCEVAddRecExpr>(LastSubscript) &&
         "Expecting a SCEV add recurrence expression");
  const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(LastSubscript);
  return AR->getStepRecurrence(SE);

The analyzer assumes that LastSubscript is a SCEVAddRecExpr in the assert but
in the following line assumes that it isn't a SCEVAddRecExpr and then warns
about a null dereference.

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/20191002/0583d258/attachment.html>

More information about the llvm-bugs mailing list