Skip to content

Commit 4e8ab5e

Browse files
committed
crypto: disable ASan for sha256_sse4 with Clang
This can alsofail to compile when optimisations are being used, see: bitcoin/bitcoin#31913. So disable just ASan for this function under any optimisation level.
1 parent 6d5edfc commit 4e8ab5e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/crypto/sha256_sse4.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313
namespace sha256_sse4
1414
{
1515
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
16-
#if defined(__clang__) && !defined(__OPTIMIZE__)
16+
#if defined(__clang__)
1717
/*
1818
clang is unable to compile this with -O0 and -fsanitize=address.
19-
See upstream bug: https://github.com/llvm/llvm-project/issues/92182
19+
See upstream bug: https://github.com/llvm/llvm-project/issues/92182.
20+
This also fails to compile with -O2, -fcf-protection & -fsanitize=address.
21+
See https://github.com/bitcoin/bitcoin/issues/31913.
2022
*/
23+
#if __has_feature(address_sanitizer)
2124
__attribute__((no_sanitize("address")))
2225
#endif
26+
#endif
2327
{
2428
static const uint32_t K256 alignas(16) [] = {
2529
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,

0 commit comments

Comments
 (0)