Skip to content

ICE: codegenprepare pass segfaults #138235

Open
@thomasgassmann

Description

@thomasgassmann

Code

fn main() {
    println!("Hello, world!");
}

Compiling the above with rustc -C no-prepopulate-passes -C passes=codegenprepare main.rs segfaults.

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (f5a1ef712 2025-03-07)
binary: rustc
commit-hash: f5a1ef7121ad661b5a21a1d02941c8064d54ee0b
commit-date: 2025-03-07
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Error output

error: rustc interrupted by SIGSEGV, printing backtrace

/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(+0x374941f) [0x751f65d4941f]
/usr/lib/libc.so.6(+0x3dcd0) [0x751f6244bcd0]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(+0x82a6c05) [0x751f60aa6c05]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(_ZN4llvm18CodeGenPreparePass3runERNS_8FunctionERNS_15AnalysisManagerIS1_JEEE+0x190) [0x751f5e00cec0]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(+0x6a6226d) [0x751f5f26226d]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(_ZN4llvm11PassManagerINS_8FunctionENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x70d) [0x751f60619b69]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(_ZN4llvm27ModuleToFunctionPassAdaptor3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x296) [0x751f6068b728]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(+0x7e8b48d) [0x751f6068b48d]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.87.0-nightly(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x21f) [0x751f60d2fe5f]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(+0x5e323c1) [0x751f684323c1]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(+0x5e2b818) [0x751f6842b818]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(_RNvXs1_Cs4GJg65wqyXp_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCs2qsHfWh5y4Q_17rustc_codegen_ssa6traits5write19WriteBackendMethods8optimize+0x186) [0x751f6839fce4]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(_RINvNtNtCsaJNBDtcVlXq_3std3sys9backtrace28___rust_begin_short_backtraceNCINvXs0_Cs4GJg65wqyXp_18rustc_codegen_llvmNtB1g_18LlvmCodegenBackendNtNtNtCs2qsHfWh5y4Q_17rustc_codegen_ssa6traits7backend19ExtraBackendMethods18spawn_named_threadNCINvNtNtB2k_4back5write10spawn_workB1O_E0uE0uEB1g_+0x187) [0x751f6839c5c7]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(+0x5d95edc) [0x751f68395edc]
/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e3b06f91230294e6.so(+0x5d96277) [0x751f68396277]
/usr/lib/libc.so.6(+0x9570a) [0x751f624a370a]
/usr/lib/libc.so.6(+0x119aac) [0x751f62527aac]

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
[1]    445041 segmentation fault (core dumped)  rustc -C no-prepopulate-passes -C passes=codegenprepare a.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions