[LLVMbugs] [Bug 12366] New: Dynamic cast false positive

4 views
Skip to first unread message

bugzill...@llvm.org

unread,
Mar 26, 2012, 10:30:06 PM3/26/12
to llvm...@cs.uiuc.edu
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: krem...@apple.com
ReportedBy: rol...@utk.edu
CC: llvm...@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.
_______________________________________________
LLVMbugs mailing list
LLVM...@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply all
Reply to author
Forward
0 new messages