From patchwork Wed Jan 21 16:15:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 431545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 305931401D0 for ; Thu, 22 Jan 2015 03:16:43 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=BdBuzr1vyb8nKUdWbFs1u+kJdd3Ag6 v9mRXQmtmjqcpUuR/enOdbe2c+AAuqyjF3T0uEgvvrfcBf5DOBqaavQd7ilUli9i UCWKl5oOKcHtGyKgG8tl9A+M+1aSRYSaIpbDnk6AOdGPcyq5dhFzkJ0pvd8fY33G jZHrmcJuby7l8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=+Ps9N85Pg5Imr8B1doLAJ7K4FRY=; b=n2Os kiQhSHPc7m9ODsQS/BCKYf07iEyAC744gARwS88ySUHhPGNOMZFErbv8s8GGKsDz BgHZDDfmmDPl/59MW82EHsxFtmhcSJvCuUrcTW8AkkY9gaWx54G4VZ06tZBREGJU uklwkOoJbF9aTczPIarxnbjOMgUOEUU7t2t5bgE= Received: (qmail 25656 invoked by alias); 21 Jan 2015 16:15:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 24947 invoked by uid 89); 21 Jan 2015 16:15:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 21 Jan 2015 16:15:32 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0LGFVtW026061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 21 Jan 2015 11:15:31 -0500 Received: from localhost (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0LGFUSE022653; Wed, 21 Jan 2015 11:15:31 -0500 Date: Wed, 21 Jan 2015 16:15:30 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [patch] libstdc++/64658 define std::atomic_init() Message-ID: <20150121161530.GF3360@redhat.com> References: <20150119160259.GL3360@redhat.com> <20150120115955.GT3360@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150120115955.GT3360@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) On 20/01/15 11:59 +0000, Jonathan Wakely wrote: >On 19/01/15 16:02 +0000, Jonathan Wakely wrote: >>We declare atomic_init() but then never define it, I assume that's >>just an accident. >> >>Although the standard says this function is non-atomic, the simplest >>fix at this stage is just to do an atomic store (when we get to stage >>1 again I'd like to make the function a friend of std::__atomic_base<> >>so it can set the private member variable directly as a simple >>non-atomic assignment). >> >>Tested x86_64-linux, *not* committed to trunk. > >Now committed to trunk. > >>commit 061dd1a073ef4646727a3f29dfa3169a760757b3 >>Author: Jonathan Wakely >>Date: Sun Jan 18 17:40:17 2015 +0000 >> >> PR libstdc++/64658 >> * include/std/atomic (atomic_init): Define. >> * testsuite/29_atomics/atomic/64658.cc: New. I forgot to make this testcase change that Ulrich suggested. Tested x86_64-linux and i686-linux, committed to trunk. commit b4d3e97d1890a1870f43e95aee493a5bb540e6f2 Author: Jonathan Wakely Date: Wed Jan 21 14:28:37 2015 +0000 * testsuite/29_atomics/atomic/64658.cc: Test stored value. diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc b/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc index 64739e0..0b2ff43 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/64658.cc @@ -17,13 +17,14 @@ // { dg-require-atomic-builtins "" } // { dg-options "-std=gnu++11" } -// { dg-do link } #include +#include int main() { std::atomic i; - atomic_init(&i, 0); + atomic_init(&i, 5); + VERIFY( i == 5 ); }