https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121495
--- Comment #3 from Sam James <sjames at gcc dot gnu.org> --- Adding __attribute__((optimize("O0"))) to static std::pair<SmallVector<GdbIndexSection::GdbSymbol, 0>, size_t> createSymbols( [...] is enough to fix it.