public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
Date: Wed, 18 Jan 2012 10:57:00 -0000 [thread overview]
Message-ID: <bug-49484-4-SGpnIpsiEX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49484-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484
--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-18 10:38:15 UTC ---
(In reply to comment #5)
> It doesn't really help - there are more races. The following does seem
> to help though, but is certainly not applicable.
>
> Index: gcc/libgcov.c
> ===================================================================
> --- gcc/libgcov.c (revision 183243)
> +++ gcc/libgcov.c (working copy)
> @@ -77,6 +77,7 @@ void __gcov_merge_delta (gcov_type *coun
> #include <errno.h>
> #include <sys/stat.h>
> #endif
> +#include <pthread.h>
>
> #ifdef L_gcov
> #include "gcov-io.c"
> @@ -584,7 +585,9 @@ void
> __gcov_flush (void)
> {
> const struct gcov_info *gi_ptr;
> + static pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
>
> + pthread_mutex_lock (&mx);
> gcov_exit ();
> for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
> {
> @@ -598,6 +601,7 @@ __gcov_flush (void)
> ci_ptr++;
> }
> }
> + pthread_mutex_unlock (&mx);
> }
>
> #endif /* L_gcov */
Would be applicable when we compile a second libgcov_r which we'd use
when linking with -pthread.
next prev parent reply other threads:[~2012-01-18 10:39 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-21 9:05 [Bug gcov-profile/49484] New: " cobexer at gmail dot com
2011-06-21 9:24 ` [Bug gcov-profile/49484] " mikpe at it dot uu.se
2011-06-24 9:34 ` cobexer at gmail dot com
2011-10-07 12:13 ` vijay910 at gmail dot com
2012-01-17 14:28 ` rguenth at gcc dot gnu.org
2012-01-17 15:21 ` rguenth at gcc dot gnu.org
2012-01-17 15:26 ` rguenth at gcc dot gnu.org
2012-01-17 15:43 ` rguenth at gcc dot gnu.org
2012-01-18 10:57 ` rguenth at gcc dot gnu.org [this message]
2012-01-18 11:51 ` jakub at gcc dot gnu.org
2012-01-18 12:03 ` rguenth at gcc dot gnu.org
2012-01-18 13:30 ` rguenth at gcc dot gnu.org
2012-01-18 13:44 ` rguenth at gcc dot gnu.org
2012-01-18 13:48 ` jakub at gcc dot gnu.org
2012-01-18 17:14 ` rguenth at gcc dot gnu.org
2012-03-12 14:23 ` rguenth at gcc dot gnu.org
2012-03-12 14:26 ` rguenth at gcc dot gnu.org
2012-03-12 15:01 ` redi at gcc dot gnu.org
2012-03-12 15:07 ` redi at gcc dot gnu.org
2012-03-12 15:10 ` redi at gcc dot gnu.org
2012-03-12 15:29 ` rguenth at gcc dot gnu.org
2012-03-12 15:52 ` rguenth at gcc dot gnu.org
2012-03-12 15:55 ` redi at gcc dot gnu.org
2012-03-12 16:00 ` redi at gcc dot gnu.org
2012-03-12 16:03 ` rguenther at suse dot de
2012-05-01 21:23 ` asharif at gcc dot gnu.org
2012-05-02 22:52 ` asharif at gcc dot gnu.org
2012-12-06 20:10 ` asharif at gcc dot gnu.org
2012-12-07 2:36 ` asharif 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-49484-4-SGpnIpsiEX@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).