rust-lang / rust-lang/rust

[ICE]: patchable_function_entry llvm crashes in TargetInstrInfo

Open
#156,052 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-LLVM C-bug F-patchable_function_entry I-crash needs-triage O-wasm T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

rustc code.rs --crate-type lib --target=wasm32-wasip2

#![feature(patchable_function_entry)]
#[patchable_function_entry(prefix_nops = 1)]
pub fn main() {}
Meta

rustc --version --verbose:

rustc 1.97.0-nightly (f53b654a8 2026-04-30)
binary: rustc
commit-hash: f53b654a8882fd5fc036c4ca7a4ff41ce32497a6
commit-date: 2026-04-30
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4
Error output

Backtrace

error: rustc interrupted by SIGILL, printing backtrace

/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(+0x3a6259c) [0x7f07a606259c]
/usr/lib/libc.so.6(+0x3e2d0) [0x7f07a244d2d0]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(_ZNK4llvm15TargetInstrInfo6getNopEv+0x0) [0x7f079de63a30]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(_ZN4llvm10AsmPrinter8emitNopsEj+0x31) [0x7f079df74dd1]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(+0x975e4a4) [0x7f07a135e4a4]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(_ZN4llvm10AsmPrinter16emitFunctionBodyEv+0x33) [0x7f07a0cf7337]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(+0x7f7d36b) [0x7f079fb7d36b]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x8e5) [0x7f07a0427025]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x28) [0x7f07a042667e]
/home/matthias/.rustup/toolchains/master/bin/../lib/../lib/libLLVM.so.22.1-rust-1.97.0-nightly(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x2b0) [0x7f07a0a12446]
/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(+0x5ff9f85) [0x7f07a85f9f85]
/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(+0x5ff9a2d) [0x7f07a85f9a2d]
/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(+0x5ff8856) [0x7f07a85f8856]
/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(_RINvNtNtCs1vjzZcfoauP_3std3sys9backtrace28___rust_begin_short_backtraceNCINvNtNtCsb9TySbMyxkH_17rustc_codegen_ssa4back5write10spawn_workNtCs4cpfUTbzlKf_18rustc_codegen_llvm18LlvmCodegenBackendE0uEB2c_+0x1e6) [0x7f07a8743766]
/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(+0x61432eb) [0x7f07a87432eb]
/home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-9b189e9ebe859b81.so(+0x61466ac) [0x7f07a87466ac]
/usr/lib/libc.so.6(+0x9697a) [0x7f07a24a597a]
/usr/lib/libc.so.6(+0x11a2bc) [0x7f07a25292bc]

note: we would appreciate a report at https://github.com/rust-lang/rust
[1]    3150517 illegal hardware instruction  ~/.rustup/toolchains/master/bin/rustc code.rs --crate-type lib

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

Run the reported rustc command with the minimal patchable_function_entry example and capture the SIGILL backtrace. Trace the wasm32-wasip2 code-generation path from patchable_function_entry into LLVM's TargetInstrInfo::getNop and AsmPrinter::emitNops. Done means this example compiles without crashing and a regression test covers the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.