From fabce97b303bd4aafa98ceb11c63800e7f4f11cd Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 11 Nov 2025 22:16:14 +0100 Subject: [PATCH] test: Remove gccbug_90348 test case The test case no longer detects this specific issue for GCC versions 12.1+, as explained in the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 thread and in this compiler-explorer playground: https://godbolt.org/z/Y48osrjM8 So remove the test case and update the -fstack-reuse=none cmake docstring with the underlying affected GCC versions, and the bug URL. --- CMakeLists.txt | 4 ++-- src/test/CMakeLists.txt | 1 - src/test/compilerbug_tests.cpp | 42 ---------------------------------- 3 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 src/test/compilerbug_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3749cf7c60e..a747a1b5729 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -493,8 +493,8 @@ try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}/src=." ) -# Currently all versions of gcc are subject to a class of bugs, see the -# gccbug_90348 test case (only reproduces on GCC 11 and earlier) and +# GCC versions 13.2 (and earlier) are subject to a class of bugs, see +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 and the meta bug # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set # -fstack-reuse=none for all gcc builds. (Only gcc understands this flag). try_append_cxx_flags("-fstack-reuse=none" TARGET core_interface) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index a67cd241764..9528004e988 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -34,7 +34,6 @@ add_executable(test_bitcoin coinscachepair_tests.cpp coinstatsindex_tests.cpp common_url_tests.cpp - compilerbug_tests.cpp compress_tests.cpp crypto_tests.cpp cuckoocache_tests.cpp diff --git a/src/test/compilerbug_tests.cpp b/src/test/compilerbug_tests.cpp deleted file mode 100644 index ef558c1e322..00000000000 --- a/src/test/compilerbug_tests.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2019-2021 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -BOOST_AUTO_TEST_SUITE(compilerbug_tests) - -#if defined(__GNUC__) -// This block will also be built under clang, which is fine (as it supports noinline) -void __attribute__ ((noinline)) set_one(unsigned char* ptr) -{ - *ptr = 1; -} - -int __attribute__ ((noinline)) check_zero(unsigned char const* in, unsigned int len) -{ - for (unsigned int i = 0; i < len; ++i) { - if (in[i] != 0) return 0; - } - return 1; -} - -void set_one_on_stack() { - unsigned char buf[1]; - set_one(buf); -} - -BOOST_AUTO_TEST_CASE(gccbug_90348) { - // Test for GCC bug 90348. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348 - for (int i = 0; i <= 4; ++i) { - unsigned char in[4]; - for (int j = 0; j < i; ++j) { - in[j] = 0; - set_one_on_stack(); // Apparently modifies in[0] - } - BOOST_CHECK(check_zero(in, i)); - } -} -#endif - -BOOST_AUTO_TEST_SUITE_END()