[Bug c/102245] [12 Regression] false int-in-bool-context warning with shift

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 8 22:38:37 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102245

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, seems the binary context is result of shorten_binary_op, we see the
1L and (((int)x) << 0) operands of BIT_AND_EXPR, result_type is therefore long
int and shorten_binary_op uses convert to convert that (((int)x) << 0) to long
int and triggers the match.pd rule and folds it into (long int)x (where x has
_Bool type).
shorten_binary_op then decides to return _Bool type, which is why we have the
bool context.


More information about the Gcc-bugs mailing list