[LLVMbugs] [Bug 12366] New: Dynamic cast false positive
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Mon Mar 26 19:30:06 PDT 2012
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=12366
             Bug #: 12366
           Summary: Dynamic cast false positive
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: roland at utk.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified
class A {
  virtual void f(){};
};
class B : public A{};
const int* f(A* a) {
  B* b = dynamic_cast<B*>(a);
  static const int i = 5;
  if(b) {
    return &i;
  } else {
    return 0;
  }
}
int main(int argc, char** argv) {
  B b;
  return *f(&b);
}
with pre-compiled binary 263 gives:
warning: Dereference of null pointer
  return *f(&b);
         ^~~~~~
-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
    
    
More information about the llvm-bugs
mailing list