rust-lang / rust-lang/rust

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

Open
#143,749 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-LLVM A-LTO C-bug I-crash O-riscv
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked qoa repository on native riscv64gc-unknown-linux-gnu hardware and run cargo build --release with the reported stack settings. Start by confirming the SIGSEGV in rustc 1.88.0 and then isolate whether serde, arrayvec, macros, or traits trigger it; done means a reduced reproducer and a confirmed compiler fix or actionable diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.