From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89876 invoked by alias); 28 Feb 2020 01:01:30 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 89868 invoked by uid 89); 28 Feb 2020 01:01:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_50,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:a9f, Hall, hall, gcc920 X-HELO: mail-ua1-f43.google.com Received: from mail-ua1-f43.google.com (HELO mail-ua1-f43.google.com) (209.85.222.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Feb 2020 01:01:28 +0000 Received: by mail-ua1-f43.google.com with SMTP id t20so387455uao.7 for ; Thu, 27 Feb 2020 17:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8oEedBioh9Ph7N/Y24PJQKAQjHWwuZkAwMLF6KKi0aU=; b=WG/nUIM0sAsSsSB7djm9YV1rGYoT2qcY67j73FeTSujrEGcDn3J2Wti3UyjJU42MLa ljzepPCSmUVKbEObZC8dLV2HByK1sC2sHxQkBE2WpvJeTfUryJd6/3VYTsSzubmrRdw2 +t0WPRZrD55Bu+3rkiittX8EcyezEI9viKlRkWIpmJkUAYdsNwgy0yMCFQxeM4f4nR9u 5lUWUrqoj3aZwo81Sf0+MaxMGDJ4aYPxgZPaXONvP99T3R1kqPUhSRcAJL/xFAbjLM9k Osqp4bMa6WDZLv/DHheXMkBNhddHx7e3oM4w1XqcpQLxulSs2HEcEfrpdG9keT2GvRDW bpPg== MIME-Version: 1.0 References: <72f6344e-d8b2-bab4-b047-63e298063492@gmch.uk> In-Reply-To: From: Jim Wilson Date: Fri, 28 Feb 2020 15:23:00 -0000 Message-ID: Subject: Re: Should atomic_xxx() functions reject not-_Atomic() arguments ? To: Chris Hall Cc: gcc-help Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00157.txt.bz2 On Thu, Feb 27, 2020 at 7:20 AM Chris Hall wrote: > Now, the Standard also tells us that _Atomic(uint64_t) and uint64_t may > have different sizes, representations and alignment. So I guess: > bar = atomic_fetch_add(&bar, 1) ; > should be an error ? __atomic_fetch_add accepts any integer or pointer type. So the fact that _Atomic(uint64_t) and uint64_t may be different types is not a problem, as long as they are still integer types. This works like an overloaded function in C++. https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins Jim