This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Counter-PATCH (libstdc++-v3, mainline) for: std::_Atomic_swap for i386
- From: Matt Kraai <kraai at alumni dot cmu dot edu>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>,gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org,danny_r_smith_2001 at yahoo dot co dot nz
- Date: Tue, 6 May 2003 05:53:58 -0700
- Subject: Re: Counter-PATCH (libstdc++-v3, mainline) for: std::_Atomic_swap for i386
- References: <200305031018.h43AIg3t027074@latour.rsch.comm.mot.com> <je7k941ds1.fsf@sykes.suse.de>
On Tue, May 06, 2003 at 02:05:18PM +0200, Andreas Schwab wrote:
> Loren James Rittle <rittle@latour.rsch.comm.mot.com> writes:
>
> |> Index: include/ext/stl_rope.h
> |> ===================================================================
> |> RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stl_rope.h,v
> |> retrieving revision 1.19
> |> diff -c -r1.19 stl_rope.h
> |> *** include/ext/stl_rope.h 16 Jan 2003 20:30:26 -0000 1.19
> |> --- include/ext/stl_rope.h 3 May 2003 10:12:15 -0000
> |> ***************
> |> *** 483,488 ****
> |> --- 483,489 ----
> |> bool _M_is_balanced:8;
> |> unsigned char _M_depth;
> |> __GC_CONST _CharT* _M_c_string;
> |> + __gthread_mutex_t _M_c_string_lock;
> |> /* Flattened version of string, if needed. */
> |> /* typically 0. */
> |> /* If it's not 0, then the memory is owned */
> |> ***************
> |> *** 498,504 ****
> |> --- 499,510 ----
> |> _Refcount_Base(1),
> |> # endif
> |> _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
> |> + #ifdef __GTHREAD_MUTEX_INIT
> |> + , _M_c_string_lock (__GTHREAD_MUTEX_INIT)
> |> { }
> |> + #else
> |> + { __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
> |> + #endif
>
> Breaks bootstrap on ia64-linux. You can't use __GTHREAD_MUTEX_INIT like
> this, it is only usable as a static initializer.
>
> In file included from /tmp/cvs/gcc-20030506/Build/ia64-suse-linux/libstdc++-v3/include/ext/rope:60,
> from ../../../../libstdc++-v3/src/ext-inst.cc:34:
> /tmp/cvs/gcc-20030506/Build/ia64-suse-linux/libstdc++-v3/include/ext/stl_rope.h: In
> constructor `__gnu_cxx::_Rope_RopeRep<_CharT,
> _Alloc>::_Rope_RopeRep(__gnu_cxx::_Rope_RopeRep<_CharT, _Alloc>::_Tag, int,
> bool, long unsigned int, typename __gnu_cxx::_Rope_rep_base<_CharT,
> _Alloc>::allocator_type)':
> /tmp/cvs/gcc-20030506/Build/ia64-suse-linux/libstdc++-v3/include/ext/stl_rope.h:503: error: expected
> primary-expression
> /tmp/cvs/gcc-20030506/Build/ia64-suse-linux/libstdc++-v3/include/ext/stl_rope.h:503: error: expected
> `)'
> /tmp/cvs/gcc-20030506/Build/ia64-suse-linux/libstdc++-v3/include/ext/stl_rope.h:503: error: expected
> primary-expression
> /tmp/cvs/gcc-20030506/Build/ia64-suse-linux/libstdc++-v3/include/ext/stl_rope.h:503: error: expected
> `;'
Likewise for powerpc-unknown-linux-gnu. The following patch
allows bootstrap to proceed. OK to apply?
Matt
--
Matt Kraai <kraai@alumni.cmu.edu>
Debian GNU/Linux Peon
* include/ext/stl_rope.h (_Rope_RopeRep::_Rope_RopeRep):
Use a temporary variable to initialize _M_c_string_lock.
Index: libstdc++-v3/include/ext/stl_rope.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stl_rope.h,v
retrieving revision 1.20
diff -c -3 -p -r1.20 stl_rope.h
*** libstdc++-v3/include/ext/stl_rope.h 5 May 2003 22:28:16 -0000 1.20
--- libstdc++-v3/include/ext/stl_rope.h 6 May 2003 12:52:32 -0000
*************** struct _Rope_RopeRep : public _Rope_rep_
*** 500,507 ****
# endif
_M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
#ifdef __GTHREAD_MUTEX_INIT
! , _M_c_string_lock (__GTHREAD_MUTEX_INIT)
! { }
#else
{ __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
#endif
--- 500,509 ----
# endif
_M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
#ifdef __GTHREAD_MUTEX_INIT
! {
! __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
! _M_c_string_lock = __tmp;
! }
#else
{ __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
#endif