mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-05 14:34:49 +02:00
Merge detect_clang_bug96267
This commit is contained in:
commit
b1fd3a60a7
@ -14,12 +14,30 @@
|
||||
|
||||
namespace kernel {
|
||||
|
||||
bool Clang_IndVarSimplify_Bug_SanityCheck() {
|
||||
// See https://github.com/llvm/llvm-project/issues/96267
|
||||
const char s[] = {0, 0x75};
|
||||
signed int last = 0xff;
|
||||
for (const char *it = s; it < &s[2]; ++it) {
|
||||
if (*it <= 0x4e) {
|
||||
} else if (*it == 0x75 && last <= 0x4e) {
|
||||
return true;
|
||||
}
|
||||
last = *it;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
util::Result<void> SanityChecks(const Context&)
|
||||
{
|
||||
if (!dbwrapper_SanityCheck()) {
|
||||
return util::Error{Untranslated("Database sanity check failure. Aborting.")};
|
||||
}
|
||||
|
||||
if (!Clang_IndVarSimplify_Bug_SanityCheck()) {
|
||||
return util::Error{Untranslated("Compiler optimization sanity check failure. Aborting.")};
|
||||
}
|
||||
|
||||
if (!ECC_InitSanityCheck()) {
|
||||
return util::Error{Untranslated("Elliptic curve cryptography sanity check failure. Aborting.")};
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ namespace kernel {
|
||||
|
||||
struct Context;
|
||||
|
||||
[[nodiscard]] bool Clang_IndVarSimplify_Bug_SanityCheck();
|
||||
|
||||
/**
|
||||
* Ensure a usable environment with all necessary library support.
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <dbwrapper.h>
|
||||
#include <kernel/checks.h>
|
||||
#include <key.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/time.h>
|
||||
@ -14,6 +15,7 @@ BOOST_FIXTURE_TEST_SUITE(sanity_tests, BasicTestingSetup)
|
||||
BOOST_AUTO_TEST_CASE(basic_sanity)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(dbwrapper_SanityCheck() == true, "dbwrapper sanity test");
|
||||
BOOST_CHECK_MESSAGE(kernel::Clang_IndVarSimplify_Bug_SanityCheck() == true, "Clang IndVarSimplify bug sanity test");
|
||||
BOOST_CHECK_MESSAGE(ECC_InitSanityCheck() == true, "secp256k1 sanity test");
|
||||
BOOST_CHECK_MESSAGE(ChronoSanityCheck() == true, "chrono epoch test");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user