[llvm-bugs] [Bug 26535] New: "tautological-undefined-compare" warning is not fired when dereferrenced null pointer is casted back to pointer
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 8 15:58:44 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26535
Bug ID: 26535
Summary: "tautological-undefined-compare" warning is not fired
when dereferrenced null pointer is casted back to
pointer
Product: new-bugs
Version: 3.6
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: dmitry at dali-studio.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Here's a sample snippet:
int& get() {
return *reinterpret_cast<int*>(0); // this code is UB
}
void test() {
int* foo = &(get());
if (foo == nullptr) { // silently optimized away, no warnings
}
}
This broke existing code while migrating from 3.4 to 3.6 (Android NDK). Yes,
the above code is UB, so a warning would be nice.
--
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/20160208/98d800a3/attachment-0001.html>
More information about the llvm-bugs
mailing list