This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH, libstdc++] Fix PR54172
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Thiago Macieira <thiago dot macieira at intel dot com>
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Wed, 5 Sep 2012 18:33:08 +0200
- Subject: Re: [PATCH, libstdc++] Fix PR54172
- References: <3027697.Y09XNY3VZT@tjmaciei-mobl2>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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