Compiler segfault in release mode, inlining/optimizing many versions of a generic function #94923
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
glacier
ICE tracked in rust-lang/glacier.
I-crash
Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I discovered a compiler error (segfault) in the following code (playground) in which a generic function is called many times with different types.
Some changes that avoid the crash:
f0
simpler (e.g.std::hint::black_box(x)
orx.wrapping_add(rand::random::<usize>())
)f0
as#[inline(never)]
For reference, I wrote the code in question because I was curious about whether the compiler would monomorphize multiple copies of the generic function
f0
for different types when the implementation does not depend on the type.Code
Meta
rustc --version --verbose
:also the following versions on Rust playground:
1.59.0
1.61.0-nightly 2022-03-12 f103b...
Error output
See backtrace. The output looks the same to me and this was too long to submit with two copies.
Backtrace
@rustbot label I-crash
The text was updated successfully, but these errors were encountered: