https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67999
--- Comment #23 from Rich Felker <bugdal at aerifal dot cx> --- I think you can always do the right-shift first. Pointer subtraction is undefined unless both pointers point to elements of the same array, and the addresses of elements of an array will inherently be congruent modulo the size of an element.