Skip to content

sha256_shani.cpp + clang: suppress -Wcast-align warnings

Summary:

This warning occurs if you are using clang with an architecture that has AVX and SHA extensions (newer Intel CPUs). src/crypto/sha256_shani.cpp uses these special functions by casting various shorter types such as int to _m128i * and other wider pointers. On GCC it appears no warning is generated, but on clang you do get a warning.

Since we were fixing warnings, I decided to also fix this one which always irked me.

Test Plan:

  • use clang as the C++ compiler
  • be on a machine with Intel AVX (newer CPUs)
  • ninja check or ninja check-secp256k1 or just plain ninja will do it. Before this commit, you should get warnings from src/crypto/sha256_shani.cpp and after this commit, none emitted from that file.

This is the warning that is fixed:

Screen_Shot_2020-03-07_at_8.21.23_PM

Edited by Calin Culianu

Merge request reports