Skip to content

feat: merge-train/barretenberg#23850

Merged
iakovenkos merged 1 commit into
nextfrom
merge-train/barretenberg
Jun 4, 2026
Merged

feat: merge-train/barretenberg#23850
iakovenkos merged 1 commit into
nextfrom
merge-train/barretenberg

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Jun 4, 2026

See merge-train-readme.md.
This is a merge-train.

…debug-build segfault (#23847)

## Problem

The nightly barretenberg **debug** build has been failing (aztec-claude
run
[26935061960](https://github.com/AztecProtocol/aztec-claude/actions/runs/26935061960);
same failure in aztec-packages runs #105/#106). The build dies with
`exit status 139` (SIGSEGV) on:

```
FAILED ... ecc_tests PippengerConstantine.SimdX4MatchesScalarPathLanewise (code: 139)
[ RUN      ] PippengerConstantine.SimdX4MatchesScalarPathLanewise
timeout: the monitored command dumped core
```

## Root cause

In
`barretenberg/cpp/src/barretenberg/ecc/scalar_multiplication/pippenger_constantine.hpp`,
`simd_u32x4_store` writes the result vector with:

```cpp
*reinterpret_cast<SimdU32x4*>(dst) = v;
```

`SimdU32x4` is `uint32_t __attribute__((vector_size(16)))`, which
carries **16-byte alignment**, so this is an *aligned* 128-bit store.
But `dst` is an arbitrary `uint32_t*` — the test and fuzzer pass a stack
`std::array<uint32_t, 4>` (4-byte aligned). At `-O0` (debug) the store
lowers to an alignment-requiring `movaps`/`movdqa` and faults whenever
`dst` is not 16-byte aligned.

This only surfaces in the **debug** nightly: the helper is
`[[gnu::always_inline]]`, so at `-O2` SROA promotes the local `out`
array 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 unaligned `movdqu` / NEON `st1` (the WASM
`wasm_v128_store` path is unchanged). This matches the helper's
documented intent.

## Verification (red/green, debug preset)

Built `ecc_tests` with the `debug` CMake preset (`build-debug`, `-O0
-D_GLIBCXX_DEBUG`), matching the nightly:

- **Without the fix:**
`PippengerConstantine.SimdX4MatchesScalarPathLanewise` → exit **139**
(SIGSEGV), reproducing the nightly.
- **With the fix:** all 6 `PippengerConstantine.*` tests pass.

A standalone repro confirmed the mechanism independently: the aligned
store to a 4-byte-aligned destination segfaults at `-O0`; the `memcpy`
form stores correctly.

---
*Created by
[claudebox](https://claudebox.work/v2/sessions/cadf49316638602b) ·
group: `slackbot`*

---------

Co-authored-by: iakovenkos <sergey.s.yakovenko@gmail.com>
@iakovenkos iakovenkos self-requested a review June 4, 2026 10:19
@iakovenkos iakovenkos added this pull request to the merge queue Jun 4, 2026
@AztecBot
Copy link
Copy Markdown
Collaborator Author

AztecBot commented Jun 4, 2026

Flakey Tests

🤖 says: This CI run detected 2 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/bd54626bc43548d7�bd54626bc43548d78;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/sentinel_status_slash.parallel.test.ts "slashes the proposer with INACTIVITY when checkpoint validation records unvalidated" (171s) (code: 0) group:e2e-p2p-epoch-flakes
\033FLAKED\033 (8;;http://ci.aztec-labs.com/8c514b7eeae78fd8�8c514b7eeae78fd88;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/multiple_validators_sentinel.parallel.test.ts "collects attestations for all validators on a node" (399s) (code: 0) group:e2e-p2p-epoch-flakes

Merged via the queue into next with commit b4dab70 Jun 4, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants