https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78436
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 40096 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40096&action=edit gcc7-pr78436.patch Untested fix. Most of the changes are just nits I ran into when debugging, the real fix is that byte_size is apparently intentionally 1 byte larger than the mode size, so that shifting by 0 to BITS_PER_UNIT - 1 has the extra byte to shift into. But when not shifting, we IMHO need to subtract that extra + 1 back.