From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id XoeRIPv5NGFvagEAgWs5BA (envelope-from ) for ; Sun, 05 Sep 2021 19:10:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gOl6G/v5NGFaZwAAB5/wlQ (envelope-from ) for ; Sun, 05 Sep 2021 17:10:19 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9F85525A66 for ; Sun, 5 Sep 2021 19:10:18 +0200 (CEST) Received: from localhost ([::1]:36158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMver-0007RA-Lp for larch@yhetil.org; Sun, 05 Sep 2021 13:10:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMved-0007NZ-3r for guix-patches@gnu.org; Sun, 05 Sep 2021 13:10:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMvec-0005GJ-S2 for guix-patches@gnu.org; Sun, 05 Sep 2021 13:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mMvec-0000Rk-Ex for guix-patches@gnu.org; Sun, 05 Sep 2021 13:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50407] [PATCH core-updates-frozen] gnu: c++-gsl: Fix build with GCC 10. Resent-From: Felix Gruber Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Sep 2021 17:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50407 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50407@debbugs.gnu.org Cc: Felix Gruber X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16308617851685 (code B ref -1); Sun, 05 Sep 2021 17:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Sep 2021 17:09:45 +0000 Received: from localhost ([127.0.0.1]:50916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMveF-0000R0-9T for submit@debbugs.gnu.org; Sun, 05 Sep 2021 13:09:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:38952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMveE-0000Qt-6Z for submit@debbugs.gnu.org; Sun, 05 Sep 2021 13:09:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMveE-000723-2H for guix-patches@gnu.org; Sun, 05 Sep 2021 13:09:38 -0400 Received: from mout02.posteo.de ([185.67.36.66]:59253) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMveB-0004s3-FG for guix-patches@gnu.org; Sun, 05 Sep 2021 13:09:37 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id EFE44240103 for ; Sun, 5 Sep 2021 19:09:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1630861773; bh=mWsy70TZF9jSH3rF/nEFVaQcozFMGvU+5r+1Odv/l7c=; h=From:To:Cc:Subject:Date:From; b=OLXMs/UnuyjT3qroEo3DETyULh970F0OYkcxmoICjuOsmF/ze14Po5kXEdO/9YyI+ EERY5i2E6iB/nljudR1wiFfkDQBn4IsHpXuw7qiygz9HnP4bHIlIiQTfWFM9hC98Yh M5nmXpscUoLnHG32yZl2CCM4Ce8Z1UCXvlB1iZZORxFjc+7JxEphRibI2uVb9epQG7 N+FuXHfTYCBVJsCAipl6JzkeD2FXI+jDKngpnihh5JeRp3UJF1apcaYFFAtLa4/9fN AUSP7Kf47NzO+afIf6adlSwrADNyCe54elHAOeQpH88shOXVCsTpgSrEQyn/5xGG3x gn/KJS1z0S1Dg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4H2dLN2fJQz6tmB; Sun, 5 Sep 2021 19:09:32 +0200 (CEST) From: Felix Gruber Date: Sun, 5 Sep 2021 17:09:28 +0000 Message-Id: <20210905170928.13754-1-felgru@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.66; envelope-from=felgru@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630861818; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=0FS3SsGDJWFdlNpUEriYts/Zc8aZPWGsafbHoDHlass=; b=LY4TRL2ldJ0UrGUtNIoYplbM1Bh2JaU9BXBD+NhfeRIuPFSH3nnQT7jcopX+QaVCMPxSZy FC1PSiZIBRipfAY+OCMTRG0C7zVwKF8bBbORTDUWe7R78DOfuZhyMNFc9Ojd7GbYWgC1nw DdUFbHcWC37Mn3qT0d0gzfULMUEM+QKXxoDUv9cFL8MeFsCq18RZhIiAJdcsNz6/AQMRo9 eDqFNWnayNx/Iq/F82TVKbL3PM90nJ3pGw193wJ6jAxwrGEaEVBsYGCjfU6L3B2jH05/Id WB1AepEo9e7SlY+pzdnoeyPgcZ0vPugVVxBVUg314m66ztuv4AC2RidAFpUmQQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630861818; a=rsa-sha256; cv=none; b=r3KPDpzw8V/BFkBrj43Qa6xEF2iMrtiFRjaYWUaSiXfgWuh0C9yZeC+3z4fWtlN1nQ/o47 SmH/uDj8rIHtoO1O46qZgqxjLaJQwOC7e9bu3iYTNMAoowYMLXRhZRcdvUeSLgss4hRqF4 KMahl5XeZFJ2DINub8J9+D9WgPLkXNhodtFY6rFglA4B7ZJORYPod+w9PjoPaS7gqYUpV9 DVa9PFtOn0nZJbwsrFeyzLcZY7J5yrPVpxYIH41YRNypGgHkhcRCsDdjPIZKwSNEV3qIIy QWpv3zTY+ASXLSeV1BAE6Sn8HntO8IzLnizTmigk7a2Apyxp94XC069v2VpBZA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b="OLXMs/Un"; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b="OLXMs/Un"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 9F85525A66 X-Spam-Score: -0.31 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1fC+I8yjKfFv * gnu/packages/cpp.scm (c++-gsl): [source]: Add a patch from Debian to fix compilation of a test. * gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/cpp.scm | 4 +- .../c++-gsl-move-array-bounds-tests.patch | 126 ++++++++++++++++++ 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index 23dcdccc6c..8c41b5b676 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -950,6 +950,7 @@ dist_patch_DATA = \ %D%/packages/patches/cyrus-sasl-ac-try-run-fix.patch \ %D%/packages/patches/cyrus-sasl-CVE-2019-19906.patch \ %D%/packages/patches/c++-gsl-find-system-gtest.patch \ + %D%/packages/patches/c++-gsl-move-array-bounds-tests.patch \ %D%/packages/patches/date-output-pkg-config-files.patch \ %D%/packages/patches/datefudge-gettimeofday.patch \ %D%/packages/patches/dbacl-include-locale.h.patch \ diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 42e9d50687..af10d1186f 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -18,6 +18,7 @@ ;;; Copyright © 2020 Brett Gilio ;;; Copyright © 2020 Milkey Mouse ;;; Copyright © 2021 Raghav Gururajan +;;; Copyright © 2021 Felix Gruber ;;; ;;; This file is part of GNU Guix. @@ -127,7 +128,8 @@ range-v3 ranges are an abstraction layer on top of iterators.") (git-file-name name version)) (patches (search-patches - "c++-gsl-find-system-gtest.patch")) + "c++-gsl-find-system-gtest.patch" + "c++-gsl-move-array-bounds-tests.patch")) (sha256 (base32 "0gbvr48f03830g3154bjhw92b8ggmg6wwh5xyb8nppk9v6w752l0")))) (build-system cmake-build-system) diff --git a/gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch b/gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch new file mode 100644 index 0000000000..0629212688 --- /dev/null +++ b/gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch @@ -0,0 +1,126 @@ +Description: Move tests that trigger -Warray-bounds to separate compilation unit + GCC 10 is now smart enough to detect violation of array boundaries that tests + are actually tested. Along with -Werror this led to tests failure, so I move + such tests to another compilation unit to have the warning deactivated for + only these tests. +Bug-Debian: https://bugs.debian.org/966895 +Author: Nicholas Guriev +Last-Modified: Wed, 19 Aug 2020 08:55:52 +0300 + +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -179,6 +179,7 @@ add_gsl_test(owner_tests) + add_gsl_test(byte_tests) + add_gsl_test(algorithm_tests) + add_gsl_test(strict_notnull_tests) ++add_gsl_test(array_bounds) + + + # No exception tests +--- /dev/null ++++ b/tests/array_bounds.cpp +@@ -0,0 +1,68 @@ ++/////////////////////////////////////////////////////////////////////////////// ++// ++// Copyright (c) 2015 Microsoft Corporation. All rights reserved. ++// ++// This code is licensed under the MIT License (MIT). ++// ++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++// THE SOFTWARE. ++// ++/////////////////////////////////////////////////////////////////////////////// ++ ++#ifdef __GNUC__ ++#pragma GCC diagnostic warning "-Warray-bounds" ++#endif // __GNUC__ ++ ++#include ++ ++#include // for gsl::multi_span ++ ++namespace gsl ++{ ++struct fail_fast; ++} // namespace gsl ++ ++namespace ++{ ++static constexpr char deathstring[] = "Expected Death"; ++} // namespace ++ ++TEST(array_bounds, subspan_from_multi_span_test) ++{ ++ int arr[5] = {1, 2, 3, 4, 5}; ++ gsl::multi_span av = arr; ++ ++ std::set_terminate([] { ++ std::cerr << "Expected Death. subspan"; ++ std::abort(); ++ }); ++ ++ EXPECT_DEATH(av.subspan(6).length(), deathstring); ++} ++ ++TEST(array_bounds, strided_span_bounds_from_strided_span_tests) ++{ ++ int arr[] = {0, 1, 2, 3}; ++ gsl::multi_span av(arr); ++ ++ std::set_terminate([] { ++ std::cerr << "Expected Death. strided_span_bounds"; ++ std::abort(); ++ }); ++ ++ // incorrect sections ++ EXPECT_DEATH(av.section(0, 0)[0], deathstring); ++ EXPECT_DEATH(av.section(1, 0)[0], deathstring); ++ EXPECT_DEATH(av.section(1, 1)[1], deathstring); ++ ++ EXPECT_DEATH(av.section(2, 5), deathstring); ++ EXPECT_DEATH(av.section(5, 2), deathstring); ++ EXPECT_DEATH(av.section(5, 0), deathstring); ++ EXPECT_DEATH(av.section(0, 5), deathstring); ++ EXPECT_DEATH(av.section(5, 5), deathstring); ++} +--- a/tests/multi_span_tests.cpp ++++ b/tests/multi_span_tests.cpp +@@ -1042,10 +1042,6 @@ TEST(multi_span_test, subspan) + EXPECT_TRUE(av.subspan(1).length() == 4); + EXPECT_TRUE(av.subspan(4).length() == 1); + EXPECT_TRUE(av.subspan(5).length() == 0); +- // Disabled test instead of fixing since multi_span is deprecated. (PR#835) +-#if !(defined(__GNUC__) && __GNUC__ == 8) +- EXPECT_DEATH(av.subspan(6).length(), deathstring); +-#endif + auto av2 = av.subspan(1); + for (int i = 0; i < 4; ++i) EXPECT_TRUE(av2[i] == i + 2); + } +--- a/tests/strided_span_tests.cpp ++++ b/tests/strided_span_tests.cpp +@@ -403,20 +403,6 @@ TEST(strided_span_tests, strided_span_bo + }); + + { +- // incorrect sections +- +- EXPECT_DEATH(av.section(0, 0)[0], deathstring); +- EXPECT_DEATH(av.section(1, 0)[0], deathstring); +- EXPECT_DEATH(av.section(1, 1)[1], deathstring); +- +- EXPECT_DEATH(av.section(2, 5), deathstring); +- EXPECT_DEATH(av.section(5, 2), deathstring); +- EXPECT_DEATH(av.section(5, 0), deathstring); +- EXPECT_DEATH(av.section(0, 5), deathstring); +- EXPECT_DEATH(av.section(5, 5), deathstring); +- } +- +- { + // zero stride + strided_span sav{av, {{4}, {}}}; + EXPECT_TRUE(sav[0] == 0); -- 2.30.2