https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87116
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- The problem is in this step of the normalisation algorithm: - As long as any appear, remove a non-dot-dot filename immediately followed by a directory-separator and a dot-dot filename, along with any immediately following directory-separator. The second time I do that, I leave a trailing slash in the native format string, but not in the vector of path components. The third time then removes two components not one. Shouldn't be too hard to fix.