https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So the problem here is libstdc++ first tries to figures out if you are linked against pthreads and if you are not then it skips locks in some cases. In this case since the main program was not linked against pthreads and you initialized libstdc++ via the include of iostream, it sets the single threaded use case.