public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "laurent.alfonsi at st dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/52604] mt allocator crashes on multi-threaded Date: Fri, 16 Mar 2012 15:32:00 -0000 [thread overview] Message-ID: <bug-52604-4-qp8z481NFc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-52604-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52604 --- Comment #1 from Laurent Aflonsi <laurent.alfonsi at st dot com> 2012-03-16 15:25:23 UTC --- I would propose to fix as follows : - Set the _M_Key=NULL when calling the freelist desctuctor. - Testing the NULL Key before using it with setspecific. see patch below : =================================================================== --- libstdc++-v3/src/mt_allocator.cc (revision 2486) +++ libstdc++-v3/src/mt_allocator.cc (working copy) @@ -47,6 +47,7 @@ if (_M_thread_freelist_array) { __gthread_key_delete(_M_key); + _M_key = NULL; ::operator delete(static_cast<void*>(_M_thread_freelist_array)); } } @@ -639,7 +640,8 @@ } } - __gthread_setspecific(freelist._M_key, (void*)_M_id); + if (freelist._M_key) + __gthread_setspecific(freelist._M_key, (void*)_M_id); } return _M_id >= _M_options._M_max_threads ? 0 : _M_id; } =================================================================== Let me know what you think Thanks very much Laurent Alfonsi
next prev parent reply other threads:[~2012-03-16 15:25 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-16 15:25 [Bug libstdc++/52604] New: " laurent.alfonsi at st dot com 2012-03-16 15:32 ` laurent.alfonsi at st dot com [this message] 2012-03-19 13:04 ` [Bug libstdc++/52604] " paolo.carlini at oracle dot com 2012-03-20 12:34 ` laurent.alfonsi at st dot com 2012-03-20 12:56 ` paolo.carlini at oracle dot com 2012-03-20 14:05 ` jakub at gcc dot gnu.org 2012-03-23 11:11 ` laurent.alfonsi at st dot com 2012-04-10 15:28 ` laurent.alfonsi at st dot com 2012-04-11 1:08 ` paolo.carlini at oracle dot com 2012-04-12 15:05 ` laurent.alfonsi at st dot com 2012-04-12 15:37 ` paolo.carlini at oracle dot com 2012-04-12 16:30 ` paolo.carlini at oracle dot com 2012-04-12 21:56 ` laurent.alfonsi at st dot com 2012-04-12 23:02 ` paolo.carlini at oracle dot com 2012-04-13 9:46 ` laurent.alfonsi at st dot com 2012-04-13 9:49 ` redi at gcc dot gnu.org 2012-04-13 10:29 ` paolo.carlini at oracle dot com 2012-04-13 10:31 ` paolo.carlini at oracle dot com 2012-04-13 12:01 ` laurent.alfonsi at st dot com 2012-04-13 12:02 ` laurent.alfonsi at st dot com 2012-04-13 14:46 ` paolo.carlini at oracle dot com 2012-04-17 13:19 ` chrbr 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-52604-4-qp8z481NFc@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: linkBe 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).