public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dvyukov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/62313] Data race in debug iterators
Date: Mon, 01 Sep 2014 10:12:00 -0000	[thread overview]
Message-ID: <bug-62313-4-oPuyWPWkiH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-62313-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Dmitry Vyukov <dvyukov at google dot com> ---
> The tests for the debug mode don't generally involve threads, so that isn't likely to help.

Then you can run any heavily multithreaded program that extensively uses stl
and is currently race-free. That last condition is somewhat tricky. I could
suggest running Chromium browser as we oversee it for data races
(http://dev.chromium.org/developers/testing/threadsanitizer-tsan-v2), but it
can be somewhat tricky.

====

The issue introduces a data race into the following program -- 'it' parameter
is constructed concurrently with list mutation. If it is a bug in user program,
them all concurrent C++ program that use stl are buggy.

class X {
    std::list<int> li_;
    std::mutex mu_;
public:
    void erase(std::list<int>::iterator it) {
        mu_.lock();
        li_.erase(it);
        mu_unlock();
    }
};


  parent reply	other threads:[~2014-09-01 10:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30 16:07 [Bug libstdc++/62313] New: " dvyukov at google dot com
2014-08-30 16:12 ` [Bug libstdc++/62313] " pinskia at gcc dot gnu.org
2014-08-30 16:23 ` dvyukov at google dot com
2014-08-31 19:07 ` redi at gcc dot gnu.org
2014-08-31 20:56 ` fdumont at gcc dot gnu.org
2014-09-01  9:44 ` redi at gcc dot gnu.org
2014-09-01 10:12 ` dvyukov at google dot com [this message]
2014-09-01 22:36 ` redi at gcc dot gnu.org
2014-09-02  3:30 ` dvyukov at google dot com
2014-09-23 20:47 ` fdumont at gcc dot gnu.org
2014-09-24  0:43 ` dvyukov at google dot com
2014-09-29 21:22 ` fdumont at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-62313-4-oPuyWPWkiH@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).