[Bug libstdc++/101037] C++20 std::atomic_flag deadlock on Windows

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 16 17:42:09 GMT 2023


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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to niXman from comment #5)
> > > can't the example be checked using thread sanitizer?
> > 
> > ... on Linux.
> 
> The implementation is completely different on linux, so that would require
> some code changes at least.

Which is actually trivial, and confirms the bug is not Windows-specific. As
comment 3 said, it's present in all non-futex targets.

I can reproduce the deadlock on linux when disabling the platform_wait path in
gcc-12.

> There was already a change to the code waiting on _M_ver in
> r12-7151-g4cf3c339815cdf and then a fix for the synchronization in
> r13-1957-gaf98cb88eb4be6 (which should be backported to the gcc-12 branch).

After backporting r13-1957 to gcc-12 the deadlock is gone. So I think this is
the same issue as PR 106183. I'll push the backport to the gcc-12 branch.

I think the changes are equivalent to Pekka's correct suggestion in comment 3,
although only the minimal fix, not the "and a bit more" part.


More information about the Gcc-bugs mailing list