[Bug libstdc++/80816] thread_local destructor on windows cause use-after-free

atomnik07 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 28 17:16:26 GMT 2025


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

Konstantin Kompan <atomnik07 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |atomnik07 at gmail dot com

--- Comment #1 from Konstantin Kompan <atomnik07 at gmail dot com> ---
Can confirm for gcc 15.1.0, MSYS2.

Exiting a thread with static thread_local std::string variable seems to be
randomly causing program termination in about half of cases. Backtrace shows
that it's caused by destructing the string, which has __p = 0xfeeefeeefeeefeee,
which means that this memory has been freed already.


More information about the Gcc-bugs mailing list