fix(bb): unaligned SIMD store in Constantine x4 recoder (nightly debug segfault)#23813
Draft
AztecBot wants to merge 1 commit into
Draft
fix(bb): unaligned SIMD store in Constantine x4 recoder (nightly debug segfault)#23813AztecBot wants to merge 1 commit into
AztecBot wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Nightly Debug Build failed (exit 139 / SIGSEGV) in
ecc_tests:The test crashes immediately at
[ RUN ], in the debug build only.Root cause
simd_u32x4_storeinpippenger_constantine.hpp(introduced in #23562) stored the 4-wide vector with:*reinterpret_cast<SimdU32x4*>(dst) = v;SimdU32x4is auint32_t __attribute__((vector_size(16)))type with 16-byte natural alignment, so this is an aligned vector store (movdqaon SSE2). Butdstcomes from astd::array<uint32_t, 4>in the test/fuzzer, which is only 4-byte aligned. Storing 16 aligned bytes to a 4-byte-aligned address faults.The helper's own comment already documented the intended lowering as the unaligned
movups/st1— the implementation just didn't match it. In optimized builds the stack layout happened to land the array on a 16-byte boundary (or the store got reassociated), so the fault only surfaced reliably at-O0in the nightly debug build.Fix
Use
__builtin_memcpy, which does not assume over-alignment ofdst. Codegen verified:-O2x86 SSE2: a singlemovups %xmm0, (%rdi)— same intended unaligned store, no perf regression.-O0: spills via aligned stack slot then copies — no aligned store todst, no fault.The WASM path (
wasm_v128_store, which is alignment-agnostic) is unchanged.Verification (red/green, debug preset)
Reproduced and fixed in
build-debugon the exact failing commit:PippengerConstantine.SimdX4MatchesScalarPathLanewiseexits139at[ RUN ](matches CI).PippengerConstantine.*tests pass.The SIMD x4 helpers are currently only exercised by the unit test and fuzzer (not yet wired into
scalar_multiplication.cpp), so this is a test/codegen correctness fix with no behavioural change to the MSM.Created by claudebox · group:
slackbot