public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time
@ 2011-06-21  9:05 cobexer at gmail dot com
  2011-06-21  9:24 ` [Bug gcov-profile/49484] " mikpe at it dot uu.se
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: cobexer at gmail dot com @ 2011-06-21  9:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

           Summary: gcov crash if two(or more) forks happen at the same
                    time
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: gcov-profile
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cobexer@gmail.com


gcov crashes the application if the application forks in multiple threads at
the same time.

#0  0x0000003612430265 in raise () from /lib64/libc.so.6
#1  0x0000003612431d10 in abort () from /lib64/libc.so.6
#2  0x000000000085e2ae in __gcov_open ()
#3  0x000000000085e559 in gcov_exit ()
#4  0x000000000085ef7f in __gcov_flush ()
#5  0x000000000085f019 in __gcov_fork ()


#0  0x000000000085effc in __gcov_merge_add ()
#1  0x000000000085ef1a in gcov_exit ()
#2  0x000000000085ef7f in __gcov_flush ()
#3  0x000000000085f019 in __gcov_fork ()

gcov (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)

uname -a
Linux hostname 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64
x86_64 GNU/Linux


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
@ 2011-06-21  9:24 ` mikpe at it dot uu.se
  2011-06-24  9:34 ` cobexer at gmail dot com
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: mikpe at it dot uu.se @ 2011-06-21  9:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2011-06-21 09:24:20 UTC ---
gcc-4.1.2 is no longer supported upstream.  Please try again with gcc-4.3.5 or
newer, preferably gcc-4.6.0 or 4.5.3.  Or report this to Red Hat who delivered
your 4.1.2-based compiler.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time 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
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: cobexer at gmail dot com @ 2011-06-24  9:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #2 from cobexer at gmail dot com 2011-06-24 09:33:42 UTC ---
I could not reproduce the crash using gcc 4.6.
So I reported this to Red Hat:
https://bugzilla.redhat.com/show_bug.cgi?id=716390


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time 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
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: vijay910 at gmail dot com @ 2011-10-07 12:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

vijay <vijay910 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vijay910 at gmail dot com

--- Comment #3 from vijay <vijay910 at gmail dot com> 2011-10-07 12:12:49 UTC ---
Have the same issue on sles 10 machine 

Back trace:
#0  0x00002aaaab835b95 in raise () from /lib64/libc.so.6
#1  0x00002aaaab836f90 in abort () from /lib64/libc.so.6
#2  0x00002aaaab86c35b in __libc_message () from /lib64/libc.so.6
#3  0x00002aaaab87134e in malloc_printerr () from /lib64/libc.so.6
#4  0x00002aaaab87295c in free () from /lib64/libc.so.6
#5  0x00002aaaab862942 in fclose@@GLIBC_2.2.5 () from /lib64/libc.so.6
#6  0x000000000048e644 in __gcov_close ()
#7  0x000000000048eb35 in gcov_exit ()
#8  0x000000000048f48f in __gcov_flush ()
#9  0x000000000048f529 in __gcov_fork ()

gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-17 14:28 UTC (permalink / raw)
  To: gcc-bugs

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;


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-17 15:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-17 14:39:47 UTC ---
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 */


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-17 15:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-17 15:20:42 UTC ---
Making __gcov_var TLS also works, with similar restrictions.  Thus completely
privatizing the state and allocating/deallocating it via gcov_open/close seems
to be a proper re-working of libgcov.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (5 preceding siblings ...)
  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
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-17 15:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-17 15:39:19 UTC ---
strace showing that file-locking, even with using gettid doesn't work:

16980 gettid( <unfinished ...>
16981 gettid()                          = 16981
16981 open("/tmp/t.gcda", O_RDWR|O_CREAT, 0666) = 3
16981 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
16981 fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
16981 close(3)                          = 0
16980 <... gettid resumed> )            = 16980
16980 open("/tmp/t.gcda", O_RDWR|O_CREAT, 0666) = 3
16980 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
16980 fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
16982 gettid()                          = 16982
16982 open("/tmp/t.gcda", O_RDWR|O_CREAT, 0666) = 3
16982 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}
<unfinished ...>
16983 gettid()                          = 16983
16983 --- SIGABRT (Aborted) @ 0 (0) ---
16982 <... fcntl resumed> )             = 0
16979 +++ killed by SIGABRT (core dumped) +++
16982 fcntl(3, F_GETFL)                 = 0x8002 (flags O_RDWR|O_LARGEFILE)
16982 close(3)                          = 0

it seems that the first close of fd 3 makes all further locks (even to
different l_pid) noops.  I suppose l_pid is simply ignored ofr F_SETLK[W]
and the current PID is used.  That makes the file-locking in libgcov
non-thread-safe.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (6 preceding siblings ...)
  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
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-18 10:57 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (7 preceding siblings ...)
  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
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-18 11:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-18 10:57:07 UTC ---
Why?  Just use gthr.h stuff...


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (8 preceding siblings ...)
  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
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-18 12:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-18 11:49:58 UTC ---
Created attachment 26363
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26363
draft patch

Draft patch that doesn't work because we do not unconditionally
provide __GTHREAD_MUTEX_INIT_FUNCTION.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (9 preceding siblings ...)
  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
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-18 13:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (10 preceding siblings ...)
  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
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-18 13:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26363|0                           |1
        is obsolete|                            |

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-18 13:26:01 UTC ---
Created attachment 26364
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26364
more complete patch

Changes __GTHREAD_MUTEX_INIT_FUNCTION to be unconditionally available (but not
for all configs).

Still shows an issue when __GTHREAD_MUTEX_INIT is not available in the
fork () path.  While we can re-init the mutex there with 
__GTHREAD_MUTEX_INIT_FUNCTION, the non-__GTHREAD_MUTEX_INIT path will
later use a broken once in init_mx_once (and of course initialize it again).
Unless it is somehow guaranteed that already triggered gthread-once things
will work fine after forking.

Otherwise seems to work fine on x86_64-linux sofar.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (11 preceding siblings ...)
  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
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-18 13:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-18 13:35:28 UTC ---
Well, pthread_once can't be called in fork child if fork has been done from
multi-threaded process (similarly to most other calls).


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (12 preceding siblings ...)
  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
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-18 17:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-18 15:41:02 UTC ---
Hmm, and as libgcov is static we can end up with multiple copies in shared
libraries which means multiple mutexes and thus exposal to the fcntl
file-locking ineffectiveness (in this case the library must fork, of course).
At least we should not see crashes even in this case because we properly
protect the non-shared __gcov_var.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (13 preceding siblings ...)
  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
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-12 14:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-12 14:23:32 UTC ---
Author: rguenth
Date: Mon Mar 12 14:23:27 2012
New Revision: 185231

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185231
Log:
2012-03-12  Richard Guenther  <rguenther@suse.de>

    * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
    * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
    (__gthread_mutex_init_function): New function.
    * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

    PR gcov/49484
    * libgcov.c: Include gthr.h.
    (__gcov_flush_mx): New global variable.
    (init_mx, init_mx_once): New functions.
    (__gcov_flush): Protect self with a mutex.
    (__gcov_fork): Re-initialize mutex after forking.
    * unwind-dw2-fde.c: Change condition under which to use
    __GTHREAD_MUTEX_INIT_FUNCTION.

Modified:
    trunk/libgcc/ChangeLog
    trunk/libgcc/gthr-posix.h
    trunk/libgcc/gthr-single.h
    trunk/libgcc/gthr.h
    trunk/libgcc/libgcov.c
    trunk/libgcc/unwind-dw2-fde.c


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (14 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-12 14:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-12 14:25:08 UTC ---
Fixed for GCC 4.8.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (15 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-12 15:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-12 15:00:46 UTC ---
If a target defines _GTHREAD_USE_MUTEX_INIT_FUNC in
lisbtdc++-v3/config/os/.../os_defines.h then following this patch line 80 in
gthr-posix.h will redefine __GTHREAD_MUTEX_INIT_FUNCTION and there will be two
conflicting definitions of __gthread_mutex_init_function on lines 749 and 757


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (16 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-12 15:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-12 15:06:52 UTC ---
(In reply to comment #16)
> If a target defines _GTHREAD_USE_MUTEX_INIT_FUNC in

e.g. this will break Tru64 (until Rainer removes support for it)

http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/config/os/osf/os_defines.h?view=markup&pathrev=184108


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (17 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-12 15:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-12 15:10:29 UTC ---
Also, gthr.h says the signature should be:
  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (18 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-12 15:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #19 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-12 15:27:46 UTC ---
(In reply to comment #18)
> Also, gthr.h says the signature should be:
>   void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)

I don't understand this?

The current define is pre-existing

#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
# undef __GTHREAD_MUTEX_INIT
# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#endif

I suppose it simply forgets to undef __GTHREAD_MUTEX_INIT_FUNCTION like
the _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC does.

I have no access to the weird platforms (but asked for help three month ago
and again a week ago).

Please open new bugs for issues you spot.

Btw, the gthr-posix.h path with _GTHREAD_USE_MUTEX_INIT_FUNC could have
never worked as there was no __gthread_mutex_init_function available
in gthr-posix.h.  Or how was that supposed to work?


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (19 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-12 15:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #20 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-12 15:52:34 UTC ---
I suppose

Index: libgcc/gthr-posix.h
===================================================================
--- libgcc/gthr-posix.h (revision 185232)
+++ libgcc/gthr-posix.h (working copy)
@@ -77,7 +77,6 @@ typedef struct timespec __gthread_time_t

 #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
 # undef __GTHREAD_MUTEX_INIT
-# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
 #endif
 #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
 # undef __GTHREAD_RECURSIVE_MUTEX_INIT

would fix it?


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (20 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-12 15:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-12 15:54:46 UTC ---
(In reply to comment #19)
> (In reply to comment #18)
> > Also, gthr.h says the signature should be:
> >   void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
> 
> I don't understand this?
> 
> The current define is pre-existing
> 
> #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
> # undef __GTHREAD_MUTEX_INIT
> # define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
> #endif
> 
> I suppose it simply forgets to undef __GTHREAD_MUTEX_INIT_FUNCTION like
> the _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC does.

No, that was intentional.

Before your commit gthr-posix.h never defined __GTHREAD_MUTEX_INIT_FUNCTION
(because all POSIX targets define PTHREAD_MUTEX_INITIALIZER) so there was no
need to undef it.  However, gthr-posix.h sometimes defines
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION (because not all POSIX targets provide
PTHREAD_RECURSIVE_MUTEX_INITIALIZER) so I needed to undef it before
(re-)defining it.  I could have alternatively done:

#ifndef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION ...
#endif

But I chose to just #undef it then #define it.


> I have no access to the weird platforms (but asked for help three month ago
> and again a week ago).

Yes, sorry, I don't subscribe to gcc-patches so only saw it when the change was
committed.

> Please open new bugs for issues you spot.

OK, will do.

> Btw, the gthr-posix.h path with _GTHREAD_USE_MUTEX_INIT_FUNC could have
> never worked as there was no __gthread_mutex_init_function available
> in gthr-posix.h.  Or how was that supposed to work?

I added __gthread_mutex_init_function, that's why it's there twice now.  Your
patch added another copy of it right below mine!

But my change was only made a month ago:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183955
So when you first prepared your patch it was correct. Now it's not.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (21 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-12 16:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-12 15:56:07 UTC ---
(In reply to comment #20)
> I suppose
> 
> Index: libgcc/gthr-posix.h
> ===================================================================
> --- libgcc/gthr-posix.h (revision 185232)
> +++ libgcc/gthr-posix.h (working copy)
> @@ -77,7 +77,6 @@ typedef struct timespec __gthread_time_t
> 
>  #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
>  # undef __GTHREAD_MUTEX_INIT
> -# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
>  #endif
>  #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
>  # undef __GTHREAD_RECURSIVE_MUTEX_INIT
> 
> would fix it?

That fixes half the problem, then there's still the duplicate
__gthread_mutex_init_function on line 749.  That should be defined
unconditionally, but according to the spec in gthr.h should return void


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (22 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenther at suse dot de @ 2012-03-12 16:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #23 from rguenther at suse dot de <rguenther at suse dot de> 2012-03-12 16:02:34 UTC ---
On Mon, 12 Mar 2012, redi at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484
> 
> --- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-12 15:56:07 UTC ---
> (In reply to comment #20)
> > I suppose
> > 
> > Index: libgcc/gthr-posix.h
> > ===================================================================
> > --- libgcc/gthr-posix.h (revision 185232)
> > +++ libgcc/gthr-posix.h (working copy)
> > @@ -77,7 +77,6 @@ typedef struct timespec __gthread_time_t
> > 
> >  #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
> >  # undef __GTHREAD_MUTEX_INIT
> > -# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
> >  #endif
> >  #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
> >  # undef __GTHREAD_RECURSIVE_MUTEX_INIT
> > 
> > would fix it?
> 
> That fixes half the problem, then there's still the duplicate
> __gthread_mutex_init_function on line 749.  That should be defined
> unconditionally, but according to the spec in gthr.h should return void

Darn...

I'm preparing a patch for testing overnight (if you beat me to it,
the obvious patch is pre-approved, removing my copy of
__gthread_mutex_init_function and making yours defined
unconditionally).

Richard.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (23 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: asharif at gcc dot gnu.org @ 2012-05-01 21:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #24 from asharif at gcc dot gnu.org 2012-05-01 21:22:51 UTC ---
Author: asharif
Date: Tue May  1 21:22:47 2012
New Revision: 187026

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187026
Log:
Backported r185231 from trunk.

2012-03-12  Richard Guenther  <rguenther@suse.de>

    * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
    * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
    (__gthread_mutex_init_function): New function.
    * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

    PR gcov/49484
    * libgcov.c: Include gthr.h.
    (__gcov_flush_mx): New global variable.
    (init_mx, init_mx_once): New functions.
    (__gcov_flush): Protect self with a mutex.
    (__gcov_fork): Re-initialize mutex after forking.
    * unwind-dw2-fde.c: Change condition under which to use
    __GTHREAD_MUTEX_INIT_FUNCTION.

Modified:
    branches/google/gcc-4_6/   (props changed)
    branches/google/gcc-4_6/gcc/ChangeLog.google-4_6
    branches/google/gcc-4_6/gcc/gthr-posix.h
    branches/google/gcc-4_6/gcc/gthr-single.h
    branches/google/gcc-4_6/gcc/gthr.h
    branches/google/gcc-4_6/gcc/libgcov.c
    branches/google/gcc-4_6/gcc/unwind-dw2-fde.c
    branches/google/gcc-4_6/libgcc/ChangeLog

Propchange: branches/google/gcc-4_6/
            ('svn:mergeinfo' modified)


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (24 preceding siblings ...)
  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
  27 siblings, 0 replies; 29+ messages in thread
From: asharif at gcc dot gnu.org @ 2012-05-02 22:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #25 from asharif at gcc dot gnu.org 2012-05-02 22:52:36 UTC ---
Author: asharif
Date: Wed May  2 22:52:28 2012
New Revision: 187067

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187067
Log:
Backported r187026 from branches/google/gcc-4_6.

2012-03-12  Richard Guenther  <rguenther@suse.de>

    * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
    * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
    (__gthread_mutex_init_function): New function.
    * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

    PR gcov/49484
    * libgcov.c: Include gthr.h.
    (__gcov_flush_mx): New global variable.
    (init_mx, init_mx_once): New functions.
    (__gcov_flush): Protect self with a mutex.
    (__gcov_fork): Re-initialize mutex after forking.
    * unwind-dw2-fde.c: Change condition under which to use
    __GTHREAD_MUTEX_INIT_FUNCTION.

Modified:
    branches/google/gcc-4_6_3-mobile/   (props changed)
    branches/google/gcc-4_6_3-mobile/gcc/ChangeLog.google-4_6
    branches/google/gcc-4_6_3-mobile/gcc/gthr-posix.h
    branches/google/gcc-4_6_3-mobile/gcc/gthr-single.h
    branches/google/gcc-4_6_3-mobile/gcc/gthr.h
    branches/google/gcc-4_6_3-mobile/gcc/libgcov.c
    branches/google/gcc-4_6_3-mobile/gcc/unwind-dw2-fde.c
    branches/google/gcc-4_6_3-mobile/libgcc/ChangeLog
    branches/google/gcc-4_6_3-mobile/libgcc/ChangeLog.google-4_6

Propchange: branches/google/gcc-4_6_3-mobile/
            ('svn:mergeinfo' modified)


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (25 preceding siblings ...)
  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
  27 siblings, 0 replies; 29+ messages in thread
From: asharif at gcc dot gnu.org @ 2012-12-06 20:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #26 from asharif at gcc dot gnu.org 2012-12-06 20:09:35 UTC ---
Author: asharif
Date: Thu Dec  6 20:09:25 2012
New Revision: 194264

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194264
Log:
2012-12-03  Ahmad Sharif <asharif@google.com>

    Backport r185231 from trunk.

    2012-03-12  Richard Guenther  <rguenther@suse.de>

    * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
    * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
    (__gthread_mutex_init_function): New function.
    * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

    PR gcov/49484
    * libgcov.c: Include gthr.h.
    (__gcov_flush_mx): New global variable.
    (init_mx, init_mx_once): New functions.
    (__gcov_flush): Protect self with a mutex.
    (__gcov_fork): Re-initialize mutex after forking.
    * unwind-dw2-fde.c: Change condition under which to use
    __GTHREAD_MUTEX_INIT_FUNCTION.


Modified:
    branches/google/gcc-4_7/   (props changed)
    branches/google/gcc-4_7/gcc/   (props changed)
    branches/google/gcc-4_7/gcc/testsuite/gcc.target/powerpc/ppc-round.c  
(props changed)
    branches/google/gcc-4_7/libgcc/ChangeLog
    branches/google/gcc-4_7/libgcc/ChangeLog.google-4_7
    branches/google/gcc-4_7/libgcc/gthr-posix.h
    branches/google/gcc-4_7/libgcc/gthr-single.h
    branches/google/gcc-4_7/libgcc/gthr.h
    branches/google/gcc-4_7/libgcc/libgcov.c
    branches/google/gcc-4_7/libgcc/unwind-dw2-fde.c
    branches/google/gcc-4_7/libjava/classpath/   (props changed)

Propchange: branches/google/gcc-4_7/
            ('svn:mergeinfo' modified)

Propchange: branches/google/gcc-4_7/gcc/
            ('svn:mergeinfo' modified)

Propchange:
branches/google/gcc-4_7/gcc/testsuite/gcc.target/powerpc/ppc-round.c
            ('svn:mergeinfo' modified)

Propchange: branches/google/gcc-4_7/libjava/classpath/
            ('svn:mergeinfo' modified)


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug gcov-profile/49484] gcov crash if two(or more) forks happen at the same time
  2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time cobexer at gmail dot com
                   ` (26 preceding siblings ...)
  2012-12-06 20:10 ` asharif at gcc dot gnu.org
@ 2012-12-07  2:36 ` asharif at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: asharif at gcc dot gnu.org @ 2012-12-07  2:36 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49484

--- Comment #27 from asharif at gcc dot gnu.org 2012-12-07 02:35:42 UTC ---
Author: asharif
Date: Fri Dec  7 02:35:37 2012
New Revision: 194279

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194279
Log:
2012-12-03  Ahmad Sharif <asharif@google.com>

    Backport r185231 from trunk.

    2012-03-12  Richard Guenther  <rguenther@suse.de>

    * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
    * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
    (__gthread_mutex_init_function): New function.
    * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

    PR gcov/49484
    * libgcov.c: Include gthr.h.
    (__gcov_flush_mx): New global variable.
    (init_mx, init_mx_once): New functions.
    (__gcov_flush): Protect self with a mutex.
    (__gcov_fork): Re-initialize mutex after forking.
    * unwind-dw2-fde.c: Change condition under which to use
    __GTHREAD_MUTEX_INIT_FUNCTION.


Modified:
    branches/google/gcc-4_7-mobile/   (props changed)
    branches/google/gcc-4_7-mobile/gcc/   (props changed)
    branches/google/gcc-4_7-mobile/gcc/testsuite/gcc.target/powerpc/ppc-round.c
  (props changed)
    branches/google/gcc-4_7-mobile/libgcc/ChangeLog.google-4_7
    branches/google/gcc-4_7-mobile/libgcc/gthr-posix.h
    branches/google/gcc-4_7-mobile/libgcc/gthr-single.h
    branches/google/gcc-4_7-mobile/libgcc/gthr.h
    branches/google/gcc-4_7-mobile/libgcc/libgcov.c
    branches/google/gcc-4_7-mobile/libgcc/unwind-dw2-fde.c
    branches/google/gcc-4_7-mobile/libjava/classpath/   (props changed)

Propchange: branches/google/gcc-4_7-mobile/
            ('svn:mergeinfo' modified)

Propchange: branches/google/gcc-4_7-mobile/gcc/
            ('svn:mergeinfo' modified)

Propchange:
branches/google/gcc-4_7-mobile/gcc/testsuite/gcc.target/powerpc/ppc-round.c
            ('svn:mergeinfo' modified)

Propchange: branches/google/gcc-4_7-mobile/libjava/classpath/
            ('svn:mergeinfo' modified)


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2012-12-07  2:36 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-21  9:05 [Bug gcov-profile/49484] New: gcov crash if two(or more) forks happen at the same time 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
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

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).