Bug 8731 - thread mutex initializers
Summary: thread mutex initializers
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-27 02:26 UTC by georg.wild
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
1.ii (86.65 KB, text/x-c++)
2003-05-21 15:17 UTC, georg.wild
Details

Note You need to log in before you can comment on or make changes to this bug.
Description georg.wild 2002-11-27 02:26:01 UTC
Hello,
I just tried to compile sigc++ with the latest g++ 3.2.1. With 3.1.x it works, but with 3.2.1 it doesn't; I got sth like this:

In file included from /usr/local/gcc/3.2.1/include/c++/3.2.1/backward/iostream.h:31,
                 from configure:8485:
/usr/local/gcc/3.2.1/include/c++/3.2.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
In file included from /usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_alloc.h:86,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/memory:55,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/string:48,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/bits/localefwd.h:49,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/ios:48,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/ostream:45,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/iostream:45,
                 from /usr/local/gcc/3.2.1/include/c++/3.2.1/backward/iostream.h:32,
                 from configure:8485:
/usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_threads.h: In constructor 
   `std::_Refcount_Base::_Refcount_Base(unsigned int)':
/usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_threads.h:74: initializer for 
   scalar variable requires one element
/usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_threads.h: At global scope:
/usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_threads.h: In instantiation of `__gthread_mutex_t std::_Swap_lock_struct<0>::_S_swap_lock':
/usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_threads.h:122:   instantiated from here
/usr/local/gcc/3.2.1/include/c++/3.2.1/bits/stl_threads.h:115: initializer for 
   scalar variable requires one element

Release:
gcc 3.2.1

Environment:
i686-pc-linux-gnu
glibc 2.3.1

How-To-Repeat:
g++ -v --save-temp -lc -lm -lpthread 1.ii
Comment 1 georg.wild 2002-11-27 02:26:01 UTC
Fix:
use 3.1.x
Comment 2 Wolfgang Bangerth 2002-11-27 06:56:28 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. The problem comes from code like this, buried deep
    inside libstdc++:
    --------------------
    struct pthread_mutex_st {
        void * res0;
        int res1;
        int res2;
        int res3;
        int res4;
        int res5;
    };
    struct pthread_mutexattr_st;
    //...
    typedef pthread_mutex_t __gthread_mutex_t;
    //...
          __gthread_mutex_t __tmp = {0, 0, 0, PTHREAD_MUTEX_TIMED_NP, { 0, 0 }};
    -----------------------
    
    This happens in bits/stl_threads.h:74, so I better
    reclassify it for libstdc++.
    
    Georg, in this case it would be interesting to have
    the original, unpreprocessed code, to see whether it
    works with newer and/or older versions of gcc. Can you
    provide a stripped down version of it?
    
    Thanks
      W.
Comment 3 Wolfgang Bangerth 2002-11-27 08:23:11 UTC
State-Changed-From-To: analyzed->open
State-Changed-Why: Thanks Georg, for the source. I cannot reproduce the
    problem, which may have to do with the fact that I am
    using glibc2.2.5. Someone with a glibc2.3.1 may want
    to look into this.
Comment 4 gwild 2002-11-28 10:59:40 UTC
From: Georg Wild <gwild@ph.tum.de>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, georg.wild@gmx.de,
 	gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/8731: thread mutex initializers
Date: Thu, 28 Nov 2002 10:59:40 +0100

 See also glibc bug 4917
 http://bugs.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=glibc&pr=4917&return_url=http%3A%2F%2Fbugs.gnu.org%2Fcgi-bin%2Fgnatsweb.pl%3Fdatabase%3Dglibc%3Bdebug%3D%3BCategory%3Dany%3BConfidential%3Dany%3BSeverity%3Dany%3BPriority%3Dany%3BResponsible%3Dany%3BState%3Dany%3BClass%3Dany%3BSubmitter-Id%3Dgnatsweb%3BSynopsis%3D%3Bmultitext%3D%3Bcolumns%3DCategory%3Bcolumns%3DSynopsis%3Bcolumns%3DConfidential%3Bcolumns%3DSeverity%3Bcolumns%3DPriority%3Bcolumns%3DResponsible%3Bcolumns%3DState%3Bcolumn s%3DQuarter%3Bcolumns%3DKeywords%3Bcolumns%3DDate-Required%3Bcolumns%3DClass%3Bcolumns%3DSubmitter-Id%3Bcolumns%3DArrival-Date%3Bcolumns%3DClosed-Date%3Bcolumns%3DCases%3Bcolumns%3DLast-Modified%3Bcolumns%3DOriginator%3Bcolumns%3DRelease%3Bsortby%3DNumber%3Bdisplaydate%3DCurrent%2520Date%3Bcmd%3Dsubmit%2520query
 
 Because of this (bad) spam protection system nearly no mails are sent to
 this bug report; I' ll foreard one of Paolo Carlini
 <pcarlini@unitus.it>:
 
 >Hi. I'm on glibc2.3.1 and indeed can confirm this.
 >
 >                Paolo.
 
                
 >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8731
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8731
Comment 5 Andrew Pinski 2003-05-23 21:27:28 UTC
Does this still happen on 3.3?
Comment 6 georg.wild 2003-05-24 07:59:50 UTC
Well, in the meantime I use glibc 2.3.2, gcc 3.3 and the last sigc++ was 1.2.5.
I a time ago installed this, and obviously it worked, but maybe they changed the
code.

When I try to compile this attachment 1.ii, I get the following, but I think you
must have the real source file to compile, but I haven't:

/tmp>gcc 1.ii
In file included from /usr/local/gcc/3.2/include/c++/3.2/bits/stl_alloc.h:86,
                 from /usr/local/gcc/3.2/include/c++/3.2/memory:55,
                 from /usr/local/gcc/3.2/include/c++/3.2/string:48,
                 from /usr/local/gcc/3.2/include/c++/3.2/bits/localefwd.h:49,
                 from /usr/local/gcc/3.2/include/c++/3.2/ios:48,
                 from /usr/local/gcc/3.2/include/c++/3.2/ostream:45,
                 from /usr/local/gcc/3.2/include/c++/3.2/iostream:45,
                 from /usr/local/gcc/3.2/include/c++/3.2/backward/iostream.h:32,
                 from configure:8485:
/usr/local/gcc/3.2/include/c++/3.2/bits/stl_threads.h: In constructor `
   std::_Refcount_Base::_Refcount_Base(unsigned int)':
/usr/local/gcc/3.2/include/c++/3.2/bits/stl_threads.h:74: error: brace-enclosed 
   initializer used to initialize `int'
/usr/local/gcc/3.2/include/c++/3.2/bits/stl_threads.h: At global scope:
/usr/local/gcc/3.2/include/c++/3.2/bits/stl_threads.h: In instantiation of
`__gthread_mutex_t std::_Swap_lock_struct<0>::_S_swap_lock':
/usr/local/gcc/3.2/include/c++/3.2/bits/stl_threads.h:122:   instantiated from here
/usr/local/gcc/3.2/include/c++/3.2/bits/stl_threads.h:115: error: brace-enclosed
   initializer used to initialize `int'
Comment 7 Andrew Pinski 2003-05-25 20:08:10 UTC
Fixed according to the submitter.