[Bug tree-optimization/126029] `!bool_var + 1`, `2 - bool_var`, `1<<!a` all should produce the same code
kaelfandrew at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jun 30 17:06:40 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126029
--- Comment #2 from Kael Franco <kaelfandrew at gmail dot com> ---
(In reply to Drea Pinski from comment #0)
> int g2(_Bool a)
> {
> return 1<<a;
> }
> ```
>
> `1 + a` would be the best
Also
int
g3 (_Bool a) {
return (a ? 2 : 1);
}
LLVM bug: https://github.com/llvm/llvm-project/issues/206708
More information about the Gcc-bugs
mailing list