fix(bb): unaligned SIMD store in pippenger_constantine tests to stop debug-build segfault#23847
Merged
iakovenkos merged 2 commits intoJun 4, 2026
Conversation
iakovenkos
approved these changes
Jun 4, 2026
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.
Problem
The nightly barretenberg debug build has been failing (aztec-claude run 26935061960; same failure in aztec-packages runs #105/#106). The build dies with
exit status 139(SIGSEGV) on:Root cause
In
barretenberg/cpp/src/barretenberg/ecc/scalar_multiplication/pippenger_constantine.hpp,simd_u32x4_storewrites the result vector with:*reinterpret_cast<SimdU32x4*>(dst) = v;SimdU32x4isuint32_t __attribute__((vector_size(16))), which carries 16-byte alignment, so this is an aligned 128-bit store. Butdstis an arbitraryuint32_t*— the test and fuzzer pass a stackstd::array<uint32_t, 4>(4-byte aligned). At-O0(debug) the store lowers to an alignment-requiringmovaps/movdqaand faults wheneverdstis not 16-byte aligned.This only surfaces in the debug nightly: the helper is
[[gnu::always_inline]], so at-O2SROA promotes the localoutarray into registers and the memory store is elided — which is why the full (release) CI is green while the debug build segfaults.The SIMD x4 helpers are currently consumed only by the unit test and fuzzer (not yet wired into the MSM hot loop), so the blast radius is the test/fuzzer.
Fix
Store via
__builtin_memcpy, which has no alignment precondition and lowers to the intended unalignedmovdqu/ NEONst1(the WASMwasm_v128_storepath is unchanged). This matches the helper's documented intent.Verification (red/green, debug preset)
Built
ecc_testswith thedebugCMake preset (build-debug,-O0 -D_GLIBCXX_DEBUG), matching the nightly:PippengerConstantine.SimdX4MatchesScalarPathLanewise→ exit 139 (SIGSEGV), reproducing the nightly.PippengerConstantine.*tests pass.A standalone repro confirmed the mechanism independently: the aligned store to a 4-byte-aligned destination segfaults at
-O0; thememcpyform stores correctly.Created by claudebox · group:
slackbot