From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8915 invoked by alias); 19 Jun 2014 01:11:45 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8858 invoked by uid 48); 19 Jun 2014 01:11:38 -0000 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61538] g++ compiled binary, linked to glibc libpthread, hangs on SGI MIPS R1x000 systems on Linux Date: Thu, 19 Jun 2014 01:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg01608.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61538 --- Comment #6 from Andrew Pinski --- This is the patch which I used for glibc to fix some libstdc++ issues: >>From 2788414e4e6a548766aa7e732fc096f9f572302e Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Thu, 1 Nov 2012 23:07:22 -0700 Subject: [PATCH] 2012-11-01 Andrew Pinski Bug #5086 * ports/sysdeps/unix/sysv/linux/mips/nptl/pthread_once.c (__pthread_once): Add release barrier before setting once_control to say initialisation is done. (clear_once_control): Add release barrier. --- ChangeLog.CAVIUM | 8 ++++++++ .../unix/sysv/linux/mips/nptl/pthread_once.c | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/ChangeLog.CAVIUM b/ChangeLog.CAVIUM index 8ed42ea..5975430 100644 --- a/ChangeLog.CAVIUM +++ b/ChangeLog.CAVIUM @@ -1,3 +1,11 @@ +2012-11-01 Andrew Pinski + + Bug #5086 + * ports/sysdeps/unix/sysv/linux/mips/nptl/pthread_once.c (__pthread_once): + Add release barrier before setting once_control to say + initialisation is done. + (clear_once_control): Add release barrier. + 2012-10-28 Andrew Pinski Bug #5059 diff --git a/ports/sysdeps/unix/sysv/linux/mips/nptl/pthread_once.c b/ports/sysdeps/unix/sysv/linux/mips/nptl/pthread_once.c index 308da8b..c2ef264 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/nptl/pthread_once.c +++ b/ports/sysdeps/unix/sysv/linux/mips/nptl/pthread_once.c @@ -28,6 +28,7 @@ clear_once_control (void *arg) { pthread_once_t *once_control = (pthread_once_t *) arg; + atomic_full_barrier (); *once_control = 0; lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE); } @@ -80,6 +81,7 @@ __pthread_once (once_control, init_routine) /* Add one to *once_control. */ + atomic_full_barrier (); atomic_increment (once_control); /* Wake up all other threads. */ -- 1.7.4.1