https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106138
Peter Cordes <peter at cordes dot ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |peter at cordes dot ca --- Comment #3 from Peter Cordes <peter at cordes dot ca> --- Ideally, bitwise & of booleans should also be handled, not just &&. A testcase (https://godbolt.org/z/qvosv8q7c) makes it easy to check both. //#define LOGIC_AND _Bool f2(char x) { _Bool b1 = x == 2; _Bool b2 = x & 1; #ifdef LOGIC_AND return b1 && b2; #else return b1 & b2; #endif } (Clang optimized it to return false for the && version, but not bitwise. GCC currently doesn't optimize either way.) This was originally posted on Stack Overflow (https://stackoverflow.com/q/72802469/224132), BTW.