What changed, and why it matters
This commit removes an old automated test that checked whether the GCC compiler had a specific bug. The test no longer catches the bug in newer GCC versions, so the developers deleted it and updated a build-system comment to note which GCC versions are affected. There is no change to the actual Bitcoin Core program code or its security behavior.
No security action required. This is a routine test-maintenance commit. Continue using the existing -fstack-reuse=none workaround for affected GCC builds.
Security signals we found
No functional code changes
Only test code and build comments removed/updated
Existing compiler mitigation (-fstack-reuse=none) remains enabled
Evidence from the diff
The patch deletes src/test/compilerbug_tests.cpp and removes it from src/test/CMakeLists.txt. The remaining change updates a CMakeLists.txt comment to clarify that GCC versions up to 13.2 are affected by bug 90348 / meta-bug 111843, and keeps the existing -fstack-reuse=none mitigation in place. No runtime code is modified.
Changed components
src/test/compilerbug_tests.cppsrc/test/CMakeLists.txtCMakeLists.txtInspect captured patch +2 / −45
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3749cf7c..a747a1b5 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 a67cd241..9528004e 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 ef558c1e..00000000
--- 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/test/unit_test.hpp>
-
-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()
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.