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: Tue, 17 Jan 2012 14:28:00 -0000	[thread overview]
Message-ID: <bug-49484-4-b7xUETJ9O3@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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-17
     Ever Confirmed|0                           |1

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-17 13:50:49 UTC ---
Confirmed with the testcase in the RH bugzilla.

I'm not sure why the issue does not reproduce with GCC 4.4 and up (I can't
see changes in libgcov).  But I can fix the issue by making the fcntl file
locking effective for threads with

Index: gcc/gcov-io.c
===================================================================
--- gcc/gcov-io.c       (revision 183243)
+++ gcc/gcov-io.c       (working copy)
@@ -32,6 +32,10 @@ static const gcov_unsigned_t *gcov_read_
 static void gcov_allocate (unsigned);
 #endif

+#if GCOV_LOCKED
+#include <sys/syscall.h>
+#endif
+
 static inline gcov_unsigned_t from_file (gcov_unsigned_t value)
 {
 #if !IN_LIBGCOV
@@ -70,9 +74,13 @@ gcov_open (const char *name, int mode)
   s_flock.l_whence = SEEK_SET;
   s_flock.l_start = 0;
   s_flock.l_len = 0; /* Until EOF.  */
+#ifdef SYS_gettid
+  s_flock.l_pid = syscall(SYS_gettid);
+#else
   s_flock.l_pid = getpid ();
 #endif
-  
+#endif
+
   gcc_assert (!gcov_var.file);
   gcov_var.start = 0;
   gcov_var.offset = gcov_var.length = 0;


  parent reply	other threads:[~2012-01-17 13:51 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 [this message]
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
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-b7xUETJ9O3@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).