https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64182
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 34222 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34222&action=edit gcc5-pr64182.patch So like this (completely untested so far)? I'm hoping that remainder can't be ever for signed numbers equal to minimum signed value and thus hopefully wi::abs nor lshift of that by 1 should overflow. For UNSIGNED, not sure if wi::neg_p () is the right test for whether lshift by 1 will overflow.