This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug gcov-profile/52627] New: [4.8 Regression] Build of libgcc fails w/o __GTHREAD_MUTEX_INIT: error: 'mx' undeclared
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 19 Mar 2012 20:45:44 +0000
- Subject: [Bug gcov-profile/52627] New: [4.8 Regression] Build of libgcc fails w/o __GTHREAD_MUTEX_INIT: error: 'mx' undeclared
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52627
Bug #: 52627
Summary: [4.8 Regression] Build of libgcc fails w/o
__GTHREAD_MUTEX_INIT: error: 'mx' undeclared
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: build
Severity: normal
Priority: P3
Component: gcov-profile
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: rguenth@gcc.gnu.org
Build: i586-pc-mingw32
On i586-pc-mingw32, one gets the following failure:
../../../gcc-trunk/libgcc/libgcov.c: In function 'init_mx':
../../../gcc-trunk/libgcc/libgcov.c:716:35: error: 'mx' undeclared (first use
in this function)
../../../gcc-trunk/libgcc/libgcov.c:716:35: note: each undeclared identifier is
reported only once for each function it appears in
The source code has the following - and unless it is declared in an #include
file, no global "mx" variable exists. "grep -w mx" find just line 716:
707 #ifdef __GTHREAD_MUTEX_INIT
708 ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx =
__GTHREAD_MUTEX_INIT;
709 #define init_mx_once()
710 #else
711 __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
712
713 static void
714 init_mx (void)
715 {
716 __GTHREAD_MUTEX_INIT_FUNCTION (&mx);
717 }
The code has been added by the commit:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185231
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.