Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 164814

Summary: static mutex initializers are not correct
Product: Red Hat Enterprise Linux 4 Reporter: Elena Zannoni <ezannoni>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: drepper
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-678 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-05 16:42:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 162722    
Bug Blocks: 156322    

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