http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54365
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-30 13:45:13 UTC --- This is not surprising, just use integer arithmetic instead of pointer arithmetic. Pointer arithmetic not only has undefined wrapping, it is defined only within the bounds of the object it points into (or one past the last byte in it, but you can't dereference it in that case).