mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 02:59:31 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user