This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, libstdc++] Fix PR54172


On Thu, Aug 30, 2012 at 12:29:51PM +0200, Thiago Macieira wrote:
> 2012-08-30  Thiago Macieira <thiago.macieira@intel.com>
> 
> 	PR libstdc++/54172
>         * libsupc++/guard.cc (__cxa_guard_acquire): Don't compare_exchange
>         from a finished state back to a waiting state.

This is ok for trunk and 4.7 branch.
The other patches I'd prefer to leave to Richard or Benjamin.

> --- a/libstdc++-v3/libsupc++/guard.cc
> +++ b/libstdc++-v3/libsupc++/guard.cc
> @@ -244,13 +244,13 @@ namespace __cxxabiv1
>      if (__gthread_active_p ())
>        {
>  	int *gi = (int *) (void *) g;
> -	int expected(0);
>  	const int guard_bit = _GLIBCXX_GUARD_BIT;
>  	const int pending_bit = _GLIBCXX_GUARD_PENDING_BIT;
>  	const int waiting_bit = _GLIBCXX_GUARD_WAITING_BIT;
>  
>  	while (1)
>  	  {
> +	    int expected(0);
>  	    if (__atomic_compare_exchange_n(gi, &expected, pending_bit, false,
>  					    __ATOMIC_ACQ_REL,
>  					    __ATOMIC_RELAXED))

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]