build: Fix warnings in x86_64 assembly check
What changed, and why it matters
This commit fixes compiler warnings in build-system tests that detect whether x86_64 assembly can be used. It initializes a variable and adds a return statement to a small test program. These changes do not affect the actual cryptographic code, runtime behavior, or security of the library.
No security action needed. Treat as a normal build-system warning fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies two build-time probes (Autotools m4 and CMake) that compile a tiny inline-assembly snippet to decide if x86_64 assembly optimizations are available. It sets tmp = 0 to silence -Wuninitialized and adds return 0; to the CMake probe to silence -Wreturn-type. The probes are only executed during configuration; the resulting compiled test program is not installed or run by end users.
Changed components
build-aux/m4/bitcoin_secp.m4cmake/CheckX86_64Assembly.cmakeInspect captured patch +4 / −3
diff --git a/build-aux/m4/bitcoin_secp.m4 b/build-aux/m4/bitcoin_secp.m4
index 048267f..1428d4d 100644
--- a/build-aux/m4/bitcoin_secp.m4
+++ b/build-aux/m4/bitcoin_secp.m4
@@ -3,7 +3,7 @@ AC_DEFUN([SECP_X86_64_ASM_CHECK],[
AC_MSG_CHECKING(for x86_64 assembly availability)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>]],[[
- uint64_t a = 11, tmp;
+ uint64_t a = 11, tmp = 0;
__asm__ __volatile__("movq \@S|@0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx");
]])], [has_x86_64_asm=yes], [has_x86_64_asm=no])
AC_MSG_RESULT([$has_x86_64_asm])
diff --git a/cmake/CheckX86_64Assembly.cmake b/cmake/CheckX86_64Assembly.cmake
index ae82cd4..ca18919 100644
--- a/cmake/CheckX86_64Assembly.cmake
+++ b/cmake/CheckX86_64Assembly.cmake
@@ -4,10 +4,11 @@ function(check_x86_64_assembly)
check_c_source_compiles("
#include <stdint.h>
- int main()
+ int main(void)
{
- uint64_t a = 11, tmp;
+ uint64_t a = 11, tmp = 0;
__asm__ __volatile__(\"movq $0x100000000,%1; mulq %%rsi\" : \"+a\"(a) : \"S\"(tmp) : \"cc\", \"%rdx\");
+ return 0;
}
" HAVE_X86_64_ASM)
set(HAVE_X86_64_ASM ${HAVE_X86_64_ASM} PARENT_SCOPE)
Why this scored 15/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.