https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67781
--- Comment #7 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> --- The exact place where it goes wrong is in find_bswap_or_nop (not the _1 helper function) in the following line: for (tmpn = n->n, rsize = 0; tmpn; tmpn >>= BITS_PER_MARKER, rsize++); This code removes the most significant zero on little endian systems but the least significant one on big endian ones, changing the value in n->n. It should do some left shift but be careful of undefined behavior. Actually, this makes me realize that we only remove the most significant zeros but the least significant ones would be fine too if the base address is adjusted.