[PATCH] D108003: [Clang] Extend -Wbool-operation to warn about bitwise and of bools with side effects

Nathan Chancellor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 13 13:36:38 PDT 2021


nathanchance added a comment.

In D108003#2944413 <https://reviews.llvm.org/D108003#2944413>, @Quuxplusone wrote:

> FWIW, all three of @nathanchance's detected lines look like good true positives to me: even if they're not //bugs//, they all look like places the programmer //meant// to write `&&` and only wrote `&` by accident. The third one might even be a bug bug, since it's doing essentially `(bounds-check offset_1) & (pointer-math-on offset_1)`.

Agreed, I do plan to send patches to fix these up. I will test the warning against a wider range of code later to help evaluate how noisy it is and look for false positives.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108003/new/

https://reviews.llvm.org/D108003



More information about the cfe-commits mailing list