This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
other/2764: Fixinclude should fix PTHREAD_MUTEX_INITIALIZER on Solaris2.7
- To: gcc-gnats at gcc dot gnu dot org
- Subject: other/2764: Fixinclude should fix PTHREAD_MUTEX_INITIALIZER on Solaris2.7
- From: wolfgang dot bangerth at iwr dot uni-heidelberg dot de
- Date: 7 May 2001 17:45:52 -0000
- Reply-To: wolfgang dot bangerth at iwr dot uni-heidelberg dot de
>Number: 2764
>Category: other
>Synopsis: Fixinclude should fix PTHREAD_MUTEX_INITIALIZER on Solaris2.7
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 07 10:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Wolfgang Bangerth
>Release: unknown-1.0
>Organization:
>Environment:
sparc-sun-solaris2.7, gcc version 3.0 20010507 (prerelease)
>Description:
In the definition of PTHREAD_MUTEX_INITIALIZER in
/usr/include/pthread.h some elements of the
pthread_mutex_t structure are not initialized, leading
to warnings with -ansi -Wall:
>How-To-Repeat:
>Fix:
fixincludes should change the definition of PTHREAD_MUTEX_INITIALIZER
in /usr/include/pthread.h, line 63, from
#define PTHREAD_MUTEX_INITIALIZER {{{0}, 0}, {{{0}}}, 0}
to something that matches the declaration of the pthread_mutex_t
structure better:
typedef struct _pthread_mutex {
struct {
uint8_t __pthread_mutex_flag[4];
uint32_t __pthread_mutex_type;
} __pthread_mutex_flags;
union {
struct {
uint8_t __pthread_mutex_pad[8];
} __pthread_mutex_lock64;
upad64_t __pthread_mutex_owner64;
} __pthread_mutex_lock;
upad64_t __pthread_mutex_data;
} pthread_mutex_t;
(Sorry, I am not enough a C hacker to know how to initialize
the union properly :-)
Regards
Wolfgang
>Release-Note:
>Audit-Trail:
>Unformatted:
>>>> c++ -ansi -Wall -o /dev/null -c a.cc
a.cc:2: warning: aggregate has a partly bracketed initializer
>>>> cat a.cc
#include <pthread.h>
pthread_mutex_t t = PTHREAD_MUTEX_INITIALIZER;
The same error also occured with gcc2.95. However, the new
libstdc++ includes this file in some place, so more people
will probably see this problem with gcc3 than with previous
gcc versions.