This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/62313] Data race in debug iterators


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]