From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from arjuna.pair.com (arjuna.pair.com [209.68.5.131]) by sourceware.org (Postfix) with ESMTPS id E3FFA385801A; Sun, 28 Feb 2021 21:31:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E3FFA385801A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bitrange.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hp@bitrange.com Received: by arjuna.pair.com (Postfix, from userid 3006) id 58DC28A549; Sun, 28 Feb 2021 16:31:02 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by arjuna.pair.com (Postfix) with ESMTP id 584178A496; Sun, 28 Feb 2021 16:31:02 -0500 (EST) Date: Sun, 28 Feb 2021 16:31:02 -0500 (EST) From: Hans-Peter Nilsson X-X-Sender: hp@arjuna.pair.com To: Thiago Macieira cc: Andreas Schwab , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int In-Reply-To: <1785026.vVn4c2NJtV@tjmaciei-mobl1> Message-ID: References: <1968544.UC5HiB4uFJ@tjmaciei-mobl1> <2303466.6GU54gbyfF@tjmaciei-mobl1> <874khyr5hn.fsf@igel.home> <1785026.vVn4c2NJtV@tjmaciei-mobl1> User-Agent: Alpine 2.20.16 (BSF 172 2016-09-29) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Feb 2021 21:31:04 -0000 On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: > On Friday, 26 February 2021 11:31:00 PST Andreas Schwab wrote: > > On Feb 26 2021, Thiago Macieira wrote: > > > On Friday, 26 February 2021 10:14:42 PST Andreas Schwab wrote: > > >> On Feb 26 2021, Thiago Macieira via Gcc-patches wrote: > > >> > - alignas(__alignof__(ptrdiff_t)) ptrdiff_t _M_a; > > >> > + alignas(__alignof__(int)) int _M_a; > > >> > > >> Futexes must be aligned to 4 bytes. > > > > > > Agreed, but doesn't this accomplish that? > > > > No. It uses whatever alignment the type already has, and is an > > elaborate no-op. > > I thought so too when I read the original line. But I expected it was written > like that for a reason, especially since the same pattern appears in other > places. > > I can change to "alignas(4)" (which is a GCC extension, I believe). Is that > the correct solution? IMNSHO make use of the corresponding atomic type. Then there'd be no need for separate what's-the-right-align-curse games. brgds, H-P