[PATCH] D130510: Missing tautological compare warnings due to unary operators
Richard Trieu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 4 15:03:37 PDT 2022
rtrieu added a comment.
void foo(long x) {
if ((x & 1) == 1L) return; // bad always false warning here
static_assert(sizeof(int) < sizeof(long), "long is bigger than int");
static_assert((long(15) & 1) == 1L, "proof that condition can be true");
}
I found this false positive case when testing your new patch. The condition is fine, but it gives an always false warning. When fixed, this would be another good test case to include.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130510/new/
https://reviews.llvm.org/D130510
More information about the cfe-commits
mailing list