This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 164814 - static mutex initializers are not correct
static mutex initializers are not correct
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc (Show other bugs)
4.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On: 162722
Blocks: 156322
  Show dependency treegraph
 
Reported: 2005-08-01 12:11 EDT by Elena Zannoni
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2005-678
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-05 12:42:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Elena Zannoni 2005-08-01 12:11:03 EDT
+++ 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 12:42:50 EDT
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.