https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99079
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #50175|0 |1 is obsolete| | --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 50176 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50176&action=edit gcc11-pr99079.patch Updated patch. Actually, I think widening conversion from signed TREE_TYPE (@1) to signed type is fine too. In the problematic case where @1 is negative (i.e. powerof2 << var which shifts it into the sign bit, certainly valid at least in C++20), if we say have int to long long conversion and we know the dividend is non-negative, it would be @0 % (long long) INT_MIN, i.e. @0 % -0x80000000LL and that can still be expanded as @0 & 0x7fffffffLL.