From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B18B53857340 for ; Sat, 8 Jun 2024 15:08:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B18B53857340 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B18B53857340 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717859307; cv=none; b=MR785ZW9UkXT3fQ5FemfS2HrC6kuaeIXsd2PJcLi1x5hPfoq0qrAKNeKZL9fP+QReMHItxonIPqFzE970j37kacbWgEZJ9/4rMovvaMnuJ+j/LghnTVBW69ACwCzNrkQ5ZCEip6OCRp4QXULMcFWHkKMLglAyX3wAcr3bJc+l3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717859307; c=relaxed/simple; bh=9r3/591yzsyoWNQpf8SsZs5KBXwLKxfvmnXRsJmuHus=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SMn8B2KNN4vyj9d4cTebMM5y5vHbdkHYcSIeDclIv+WCaLinPuprdgrp+byT9cNTySxfBAkvD9pBa74OQkyniYcdHMzDokIL9SMHoshS2ViPOtuUq8jyA4FJW/n9PEQ98ApL+RfxrVAPzO7X725xWbRPm2LwI4NtGqhi2P011tU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717859305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZXrHzYoLqhYd0aEvmVzTWPOXOmBiQnzXoV+cKyzezvU=; b=DLemyOWqyDQH1RIJ/LHWLOuKbVJyh0y4eZJwBpIu3RKj3p5n1yU2mML8ccxktOkb4Trl0z XUSXLOxB9JwoQzNMVGSbCQv/gJh9EroWFUar/wu3i3dEO6Bq9vBLkz4hL3YPoOAo/R3hZj cuxAcjEs8C/s/DeAhm9bg7Gjhh9EHLg= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-AeSVb5raOzK_5nzFQl61Zg-1; Sat, 08 Jun 2024 11:08:22 -0400 X-MC-Unique: AeSVb5raOzK_5nzFQl61Zg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2EF6819560AD; Sat, 8 Jun 2024 15:08:21 +0000 (UTC) Received: from localhost (unknown [10.39.192.128]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 434971956089; Sat, 8 Jun 2024 15:08:19 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed v2][libstdc++] Add constexpr specifier to function __atomic_impl::__clear_padding Date: Sat, 8 Jun 2024 16:07:00 +0100 Message-ID: <20240608150818.457672-1-jwakely@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Here's what I pushed to trunk, using the macro instead of the plain keyword, and with a testcase. Thanks for the patch, Deev. Tested x86_64-linux. Pushed to trunk. I'll backport this too. -- >8 -- This is called from the std::atomic constructor, which needs to be usable in constant expressions. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (__atomic_impl::__clear_padding): Add missing constexpr specifier. * testsuite/29_atomics/atomic_float/constinit.cc: New test. Co-authored-by: Jonathan Wakely --- libstdc++-v3/include/bits/atomic_base.h | 2 +- libstdc++-v3/testsuite/29_atomics/atomic_float/constinit.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic_float/constinit.cc diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 062f1549740..20901b7fc06 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -968,7 +968,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - _GLIBCXX_ALWAYS_INLINE _Tp* + _GLIBCXX_ALWAYS_INLINE _GLIBCXX14_CONSTEXPR _Tp* __clear_padding(_Tp& __val) noexcept { auto* __ptr = std::__addressof(__val); diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_float/constinit.cc b/libstdc++-v3/testsuite/29_atomics/atomic_float/constinit.cc new file mode 100644 index 00000000000..6b3f4f76b4c --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/constinit.cc @@ -0,0 +1,3 @@ +// { dg-do compile { target c++20 } } +#include +constinit std::atomic a(0.0f); -- 2.45.1