https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114615
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- The dumb part is that __n here comes from wcslen(__s2), so the compiler is able to track that __s2 is only two bytes, but not capable of tracking that __n == 0. Specifically, __n is (__s2 + wcslen(__s2)) - __s2 which is just wcslen(L"") which is 0.