GNU bug report logs -
#50407
[PATCH core-updates-frozen] gnu: c++-gsl: Fix build with GCC 10.
Previous Next
Reported by: Felix Gruber <felgru <at> posteo.net>
Date: Sun, 5 Sep 2021 17:10:02 UTC
Severity: normal
Tags: patch
Done: Guillaume Le Vaillant <glv <at> posteo.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50407 in the body.
You can then email your comments to 50407 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#50407
; Package
guix-patches
.
(Sun, 05 Sep 2021 17:10:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Felix Gruber <felgru <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Sun, 05 Sep 2021 17:10:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* 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 <brettg <at> gnu.org>
;;; Copyright © 2020 Milkey Mouse <milkeymouse <at> meme.institute>
;;; Copyright © 2021 Raghav Gururajan <rg <at> raghavgururajan.name>
+;;; Copyright © 2021 Felix Gruber <felgru <at> posteo.net>
;;;
;;; 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 <guriev-ns <at> ya.ru>
+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 <gtest/gtest.h>
++
++#include <gsl/multi_span> // 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<int> 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<int> 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<int, 1> sav{av, {{4}, {}}};
+ EXPECT_TRUE(sav[0] == 0);
--
2.30.2
Reply sent
to
Guillaume Le Vaillant <glv <at> posteo.net>
:
You have taken responsibility.
(Mon, 06 Sep 2021 08:22:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Felix Gruber <felgru <at> posteo.net>
:
bug acknowledged by developer.
(Mon, 06 Sep 2021 08:22:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 50407-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Patch pushed as 86af6091d8ca1cc69ac12267d51544d50268e146.
Thanks.
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 04 Oct 2021 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 275 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.