https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111519
--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> --- Complicated. Things have gone wrong before the strlen pass which is given: _73 = e; _72 = *_73; ... *_73 = prephitmp_23; d = _72; Here the assignment to *_73 overwrites the value of f (at *e) which then invalidates the use of _72 resulting in the wrong value for d. But figuring out which pass is at fault (perhaps complete loop unrolling?) is tricky.