Bug 164814 - static mutex initializers are not correct
Summary: static mutex initializers are not correct
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc
Version: 4.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On: 162722
Blocks: 156322
TreeView+ depends on / blocked
 
Reported: 2005-08-01 16:11 UTC by Elena Zannoni
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHBA-2005-678
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-10-05 16:42:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:678 0 qe-ready SHIPPED_LIVE glibc bug fix update 2005-10-05 04:00:00 UTC

Description Elena Zannoni 2005-08-01 16:11:03 UTC
+++ This bug was initially created as a clone of Bug #162722 +++

Description:
Compiling code with '-W' causes warnings due to the static mutex initializer
macros not being complete/correct.

Release:
Fedora Core 4.

Reproducible:
Easily reproduced with the code below and also attached.
#include <stdio.h>
#include <pthread.h>

static pthread_mutex_t some_static_mutex = PTHREAD_MUTEX_INITIALIZER;
//static pthread_rwlock_t some_static_rwmutex = PTHREAD_RWLOCK_INITIALIZER;
static pthread_cond_t some_static_condition = PTHREAD_COND_INITIALIZER;

int main(int argc, char ** argv)
{
        fprint("compiler error above if compiled with -W option\n");
}

/*
gcc -W fc4-gcc4-mutex.c -c 
fc4-gcc4-mutex.c:4: warning: missing initializer
fc4-gcc4-mutex.c:4: warning: (near initialization for
'some_static_mutex.__data.__count')
fc4-gcc4-mutex.c:6: warning: missing initializer
fc4-gcc4-mutex.c:6: warning: (near initialization for
'some_static_condition.__data.__futex')

NOTE:  I believe the pthread_rwlock_t has the same issue but I do not use it
in my project so I didn't test it.

*/

Steps to Reproduce:
1. cut/paste the above code into a file called 'fc4-gcc4-mutex.c'
2. run 'gcc -W -c fc4-gcc4-mutex.c'  I like 'gcc -W -Wall -Werror -c
fc4-gcc4-mutex.c'

  
Actual results:
fc4-gcc4-mutex.c:4: warning: missing initializer
fc4-gcc4-mutex.c:4: warning: (near initialization for
'some_static_mutex.__data.__count')
fc4-gcc4-mutex.c:6: warning: missing initializer
fc4-gcc4-mutex.c:6: warning: (near initialization for
'some_static_condition.__data.__futex')


Expected results:
No warnings and successful compile.

Additional info:

Comment 2 Red Hat Bugzilla 2005-10-05 16:42:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-678.html



Note You need to log in before you can comment on or make changes to this bug.