[LLVMbugs] [Bug 21726] New: -Wundefined-bool-conversion not raised in all cases where optimization is applied
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Dec 3 08:18:33 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=21726
Bug ID: 21726
Summary: -Wundefined-bool-conversion not raised in all cases
where optimization is applied
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: clang at martinien.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hi,
in function indirect() below, no warning for the check of the address of the
reference is raised, but the check is still optimized out at -O1. This is a big
problem for codebases that have such constructs, since it can be hard to track
down the resulting errors at runtime. direct() raises the warning as expected.
int indirect()
{
int a = 42;
int &r = a;
int *p = &r;
if (p) // no warning!
return 0;
else
return 1;
}
int direct()
{
int a = 42;
int &r = a;
if (&r) // -Wundefined-bool-conversion
return 0;
else
return 1;
}
Best regards,
Martin
--
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/20141203/fe8b2ba0/attachment.html>
More information about the llvm-bugs
mailing list