https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109609
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note strcpy arguments cannot be overlapping if the dst overlaps with the src, then the behavior is undefined. I think you are hitting that undefined behavior here.