Skip to content

sim: Fix STATUS_ACCESS_VIOLATION on Windows x86_64 #2771

Open
josesimoes wants to merge 1 commit into
mcu-tools:mainfrom
josesimoes:sim-context-windows
Open

sim: Fix STATUS_ACCESS_VIOLATION on Windows x86_64 #2771
josesimoes wants to merge 1 commit into
mcu-tools:mainfrom
josesimoes:sim-context-windows

Conversation

@josesimoes

Copy link
Copy Markdown
Contributor

The C jmp_buf embedded in this FFI struct needs 16-byte alignment under mingw's setjmp (saves XMM registers with movaps). The C compiler aligns the struct to 16 to satisfy that, but Rust's repr(C) only picked the 8-byte alignment of [u64; 48], so the field could land 8-byte aligned and setjmp faulted with STATUS_ACCESS_VIOLATION.

The C `jmp_buf` embedded in this FFI struct needs 16-byte alignment under
mingw's setjmp (saves XMM registers with movaps). The C compiler aligns
the struct to 16 to satisfy that, but Rust's repr(C) only picked the
8-byte alignment of [u64; 48], so the field could land 8-byte aligned and
setjmp faulted with STATUS_ACCESS_VIOLATION.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>
@josesimoes josesimoes requested a review from d3zd3z as a code owner June 19, 2026 11:57
@josesimoes josesimoes force-pushed the sim-context-windows branch from de97598 to 7057338 Compare June 19, 2026 11:57
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.

1 participant