From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109855 invoked by alias); 26 Mar 2015 11:54:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 109824 invoked by uid 89); 26 Mar 2015 11:54:25 -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; Thu, 26 Mar 2015 11:54:25 +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 (Postfix) with ESMTPS id 45E77AC7DA; Thu, 26 Mar 2015 11:54:23 +0000 (UTC) Received: from localhost (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2QBsMcT000598; Thu, 26 Mar 2015 07:54:22 -0400 Date: Thu, 26 Mar 2015 11:54:00 -0000 From: Jonathan Wakely To: Richard Henderson Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [libstdc++/65033] Give alignment info to libatomic Message-ID: <20150326115421.GK9755@redhat.com> References: <54DD19B7.6060401@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <54DD19B7.6060401@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-03/txt/msg01363.txt.bz2 On 12/02/15 13:23 -0800, Richard Henderson wrote: >When we fixed PR54005, making sure that atomic_is_lock_free returns the same >value for all objects of a given type, we probably should have changed the >interface so that we would pass size and alignment rather than size and object >pointer. > >Instead, we decided that passing null for the object pointer would be >sufficient. But as this PR shows, we really do need to take alignment into >account. > >The following patch constructs a fake object pointer that is maximally >misaligned. This allows the interface to both the builtin and to libatomic to >remain unchanged. Which probably makes this back-portable to maintenance >releases as well. > >I believe that for all of our current systems, size_t == uintptr_t, so the >reinterpret_cast ought not generate warnings. > >The test case is problematic, as there's currently no good place to put it. >The libstdc++ testsuite doesn't have the libatomic library path configured, and >the libatomic testsuite doesn't have the libstdc++ include paths configured. >Yet another example where we really need an install tree for testing. Thoughts? > > >Ok? OK for trunk. > >r~ > * include/bits/atomic_base.h (__atomic_base::is_lock_free): Build > a fake pointer indicating type alignment. > (__atomic_base::is_lock_free): Likewise. > * include/std/atomic (atomic::is_lock_free): Likewise.