From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id A74973858D38; Wed, 10 Jan 2024 11:53:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A74973858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=foss.arm.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=foss.arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A74973858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704887584; cv=none; b=rxknL6Xj9GkcPfGEQxrlgBgb21qvR5ZjOxlI0Pf5DLilc+5PDXKt4PsQAiPejD7d+fTHKQPIZMX0BNKq4zgwAHDezBRiWEVx0pM/rBcSXsayOI+MN24LjWEksnXt1E9Y7Rd2ax2Xg6FEEHgQR7dmekfLvWmHQuWov1hOjFBh2rw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704887584; c=relaxed/simple; bh=+wPzLJ9kQkrJ5XTOaKvmxBLTmQb+bCSvDyrrvIHoMg4=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=Jwi7UBTAX9z8ehvaLZNCNZR5Vyow+5Ofv6u9BtirsvmdnP3fBUkNv4+Xunwharc9RWvUmbNyj5rCq3EhWhF7SkI89iLxU10x0AwDtBZFt1H/CaUGbUMKkB0gNYP6HMeVrttghoEbC05A7DLKlv0aDl9YIaxiG93qc6SJsliXCSs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5D8352F4; Wed, 10 Jan 2024 03:53:46 -0800 (PST) Received: from [10.57.45.9] (unknown [10.57.45.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC7773F73F; Wed, 10 Jan 2024 03:52:57 -0800 (PST) Message-ID: <2ffc6c58-4910-43ab-bc73-b47923d230ea@foss.arm.com> Date: Wed, 10 Jan 2024 11:52:55 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] libgfortran: Bugfix if not define HAVE_ATOMIC_FETCH_ADD Content-Language: en-GB To: Lipeng Zhu , tobias@codesourcery.com Cc: Richard.Earnshaw@arm.com, fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org, hongjiu.lu@intel.com, jakub@redhat.com, pan.deng@intel.com, rep.dot.nop@gmail.com, thomas@codesourcery.com, tianyou.li@intel.com, tkoenig@netcologne.de, wangyang.guo@intel.com References: <20240105014325.1490280-1-lipeng.zhu@intel.com> From: Richard Earnshaw In-Reply-To: <20240105014325.1490280-1-lipeng.zhu@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3495.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 05/01/2024 01:43, Lipeng Zhu wrote: > This patch try to fix the bug when HAVE_ATOMIC_FETCH_ADD is > not defined in dec_waiting_unlocked function. As io.h does > not include async.h, the WRLOCK and RWUNLOCK macros are > undefined. > > libgfortran/ChangeLog: > > * io/io.h (dec_waiting_unlocked): Use > __gthread_rwlock_wrlock/__gthread_rwlock_unlock or > __gthread_mutex_lock/__gthread_mutex_unlock functions > to replace WRLOCK and RWUNLOCK macros. > > Signed-off-by: Lipeng Zhu Has this been committed yet? R. > --- > libgfortran/io/io.h | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h > index 15daa0995b1..c7f0f7d7d9e 100644 > --- a/libgfortran/io/io.h > +++ b/libgfortran/io/io.h > @@ -1020,9 +1020,15 @@ dec_waiting_unlocked (gfc_unit *u) > #ifdef HAVE_ATOMIC_FETCH_ADD > (void) __atomic_fetch_add (&u->waiting, -1, __ATOMIC_RELAXED); > #else > - WRLOCK (&unit_rwlock); > +#ifdef __GTHREAD_RWLOCK_INIT > + __gthread_rwlock_wrlock (&unit_rwlock); > + u->waiting--; > + __gthread_rwlock_unlock (&unit_rwlock); > +#else > + __gthread_mutex_lock (&unit_rwlock); > u->waiting--; > - RWUNLOCK (&unit_rwlock); > + __gthread_mutex_unlock (&unit_rwlock); > +#endif > #endif > } >