https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60966
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Hideaki Kimura from comment #11) > Hi, I'm also (seemingly) hitting this issue. > When I run my program with valgrind, I get what Thomas reported. > > ==22319== Invalid read of size 4 > ==22319== at 0x370940D201: pthread_once (pthread_once.S:111) > ==22319== by 0x4C80524: ....<my functions> (gthr-default.h:699) > ... > ==22319== Address 0x52c52a4 is 132 bytes inside a block of size 136 free'd > ==22319== at 0x4A07991: operator delete(void*) (in > /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) > ==22319== by 0x4C82456: ...<my function> (shared_ptr_base.h:161) > ==22319== by 0x370C4B52AF: execute_native_thread_routine (thread.cc:84) > ==22319== by 0x3709407F32: start_thread (pthread_create.c:309) > ==22319== by 0x37090F4DEC: clone (clone.S:111) > ==22319== This means you are waiting on an object that has gone out of scope. WIthout more information it's not possible to tell if this is a bug in your program or the standard libary. I'll try to reproduce it with Thomas's code...