[LLVMbugs] [Bug 22901] New: No Warning on logical ‘and’ of mutually exclusive tests
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Mar 13 17:36:26 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=22901
Bug ID: 22901
Summary: No Warning on logical ‘and’ of mutually exclusive
tests
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: chengniansun at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The condition "(a > 0 && a < -1)" is always false. Gcc emits a warning, but
Clang currently has not supported this yet.
$: cat t.c
int f(int a) {
return (a > 0 && a < -1) ? 0 : 1;
}
$: clang-trunk -c -Weverything -Wno-missing-prototypes t.c
$: gcc-trunk -c -Wlogical-op t.c
t.c: In function ‘f’:
t.c:2:17: warning: logical ‘and’ of mutually exclusive tests is always false
[-Wlogical-op]
return (a > 0 && a < -1) ? 0 : 1;
^
$:
--
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/20150314/75ce85bb/attachment.html>
More information about the llvm-bugs
mailing list