This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/62313] Data race in debug iterators
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 31 Aug 2014 19:07:10 +0000
- Subject: [Bug libstdc++/62313] Data race in debug iterators
- Auto-submitted: auto-generated
- References: <bug-62313-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62313
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-08-31
Ever confirmed|0 |1
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Dmitry Vyukov from comment #0)
> As far as I see the safe iterator first attaches itself to the sequence in
> _Safe_iterator_base ctor:
>
> _Safe_iterator(const _Safe_iterator& __x)
> : _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
>
> After that point it's accessible from other threads (in particular that
> invalidate other iterators).
> Only then it sets _M_current.
> But _M_current is already read from another thread that invalidates a
> different iterator.
Yes, that's a bug.
> It can make sense to run some extensive test suite (if one exists) for debug
> iterators with -fsanitize=thread -O{0,1,2}.
The tests for the debug mode don't generally involve threads, so that isn't
likely to help.