From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by sourceware.org (Postfix) with ESMTPS id D8DC2385E44A; Wed, 6 Apr 2022 14:42:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D8DC2385E44A From: Hans-Peter Nilsson To: Jonathan Wakely CC: , In-Reply-To: (message from Jonathan Wakely on Tue, 5 Apr 2022 20:47:58 +0200) Subject: Re: [PATCH] libstdc++-v3 expected: Don't test ABI-variant properties in requirements.cc MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT References: <20220405164329.99C9F20426@pchp3.se.axis.com> Message-ID: <20220406144234.781D92042B@pchp3.se.axis.com> Date: Wed, 6 Apr 2022 16:42:34 +0200 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2022 14:42:39 -0000 > From: Jonathan Wakely > Date: Tue, 5 Apr 2022 20:47:58 +0200 > On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via > Libstdc++, > > > wrote: > Ok to commit? > -------------- 8< -------------- > > Without this, for a target where alignment and structure-sizes are by > default byte-aligned, such as cris-elf, you'll see, in libstdc++.log: > > /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed > /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note: the comparison reduces to '(5 == 2)' > compiler exited with status 1 > FAIL: 20_util/expected/requirements.cc (test for excess errors) > Excess errors: > /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed > > It seems the intent is a smoke-test and that conditionals for ABI > properties are out of scope, so best to just delete this particular > line. > > The idea is to ensure the object is no larger than necessary. > > I think we could use == sizeof(void*)+alignof(void*) which > would be correct everywhere. Does that work for cris-elf? Oh right, yes it does. Ok then, I'll commit this: -------------- 8< -------------- [PATCH v2] libstdc++-v3 expected: Correct minimal-size test in requirements.cc Without this, for a target where alignment and structure-sizes are by default byte-aligned, such as cris-elf, you'll see, in libstdc++.log: /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note: the comparison reduces to '(5 == 2)' compiler exited with status 1 FAIL: 20_util/expected/requirements.cc (test for excess errors) Excess errors: /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed The intent of that line is to check that the object is not larger than necessary. libstdc++-v3/: * testsuite/20_util/expected/requirements.cc: Correct minimal-size test. --- libstdc++-v3/testsuite/20_util/expected/requirements.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/libstdc++-v3/testsuite/20_util/expected/requirements.cc b/libstdc++-v3/testsuite/20_util/expected/requirements.cc index 485aa338679c..a51a007a4fc3 100644 --- a/libstdc++-v3/testsuite/20_util/expected/requirements.cc +++ b/libstdc++-v3/testsuite/20_util/expected/requirements.cc @@ -124,6 +124,6 @@ static_assert( move_assignable< void, G > ); // QoI properties static_assert( sizeof(std::expected) == 2 ); static_assert( sizeof(std::expected) == 2 ); -static_assert( sizeof(std::expected) == 2 * __alignof(void*) ); +static_assert( sizeof(std::expected) == sizeof(void*) + __alignof(void*) ); static_assert( alignof(std::expected) == 1 ); static_assert( alignof(std::expected) == alignof(void*) ); -- 2.30.2