https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102918
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2021-10-25 Status|UNCONFIRMED |WAITING --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- std::sub_match only has one constructor, and it initializes the bool. The only stores to that variable are literal treu or false values, or the result of a boolean expression first != last. So there's no way I can see for the library to cause this behaviour Are you sure you're not causing undefined behaviour in your own code? Have you tried building with -D_GLIBCXX_DEBUG to get runtime checks in std::match_results. Without more details there's nothing we can do here. The <regex> code looks correct.