Skip to content

rustc SIGSEGV on RISC-V when compiling serde and other crates (stack overflow on 4 GB stack) #143749

Open
@planetryan

Description

@planetryan

I tried compiling this Rust project on native riscv hardware. The project uses deps like serde, arrayvec, and others that involve macros and traits.

I expected to see this happen:
build using cargo build --release

Instead this happened:

rustc crashes with a segmentation fault (SIGSEGV) inside libc.so.6. This occurs on both stable and nightly Rust, even after setting high stack limits (RUST_MIN_STACK=4294967296, i.e. 4 GB) and with 8 GiB of swap active.

rustc --version --verbose:

rayan@k1:~$ rustc --version --verbose
rustc 1.88.0 (6b00bc3 2025-06-23)
binary: rustc
commit-hash: 6b00bc3
commit-date: 2025-06-23
host: riscv64gc-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5

Repository:
https://github.com/planetryan/qoa

To reproduce, clone the repository and run on riscv cpu

export RUST_MIN_STACK=4294967296

ulimit -s unlimited

cargo build --release

Even compiling deps like serde crashs the compiler with a SIGSEGV on native RISC-V hardware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-LTOArea: Link-time optimization (LTO)C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-riscvTarget: RISC-V architecture

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions