[Bug libstdc++/98108] Broken Schwarz counter for iostreams initialization

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 3 07:28:24 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98108

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this is undefined since global object initialization order is not
well-defined between TUs so thread1/thread2 and std::cout construction are not
well-ordered.

It probably works (by accident) when doing

g++ -pthread file2.cc file1.cc


More information about the Gcc-bugs mailing list