From patchwork Sun Sep 5 17:09:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Gruber X-Patchwork-Id: 32648 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 18B2927BBE3; Sun, 5 Sep 2021 18:10:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7271427BBE1 for ; Sun, 5 Sep 2021 18:10:12 +0100 (BST) Received: from localhost ([::1]:36158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMvel-0007RA-H6 for patchwork@mira.cbaines.net; Sun, 05 Sep 2021 13:10:11 -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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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);