Skip to content

Fix: Initialize dummy_input in simsimd_capabilities to fix MSan false positive#302

Merged
ashvardanian merged 1 commit intoashvardanian:mainfrom
ClickHouse:fix-msan-dummy-input
Mar 4, 2026
Merged

Fix: Initialize dummy_input in simsimd_capabilities to fix MSan false positive#302
ashvardanian merged 1 commit intoashvardanian:mainfrom
ClickHouse:fix-msan-dummy-input

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Contributor

Summary

simsimd_capabilities probes SIMD instructions with an uninitialized dummy_input buffer and n=0. SVE implementations (e.g. simsimd_cos_f32_sve) use do { ... } while loops that always execute the body once. MemorySanitizer doesn't understand SVE predicated loads and reports use-of-uninitialized-value false positives.

The fix simply initializes the buffer to zero: largest_scalar_t dummy_input[1] = {0};

Context

Discovered during ClickHouse CI stress testing with MSan on ARM (aarch64).

… positive

`simsimd_capabilities` probes SIMD instructions with an uninitialized
`dummy_input` buffer and `n=0`. SVE implementations use `do { ... } while`
loops that always execute the body once. MemorySanitizer doesn't understand
SVE predicated loads and reports use-of-uninitialized-value.

Initialize the buffer to zero to silence the false positive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants