[llvm-bugs] [Bug 42666] New: Clang doesn't warn on some obviously tautological comparisons
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 18 04:57:15 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42666
Bug ID: 42666
Summary: Clang doesn't warn on some obviously tautological
comparisons
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: chandlerc at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
https://godbolt.org/z/iocaCS
```
#include <stdlib.h>
enum Flags {
FLAG_A = 0b001,
FLAG_B = 0b010,
FLAG_C = 0b100,
};
void a();
void b();
void c();
void f(Flags f) {
if (!!(f | FLAG_A)) {
a();
} else if (!!(f | FLAG_B)) {
b();
} else if (!!(f | FLAG_C)) {
c();
} else {
abort();
}
}
```
See also: https://twitter.com/dvyukov/status/1151748350120779781
--
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/20190718/ffb167f6/attachment.html>
More information about the llvm-bugs
mailing list