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

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

https://llvm.org/reports/scan-build/report-LoopCacheAnalysis.cpp-getLastCoefficient-5-1.html#EndPath

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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to