GVN can cause OOM
Open
@cjgillot is already working on this.
Since Jun 14, 2026.
A-mir-opt-GVN
C-bug
I-compilemem
I-crash
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
//@compile-flags: -Zmir-opt-level=5
use std::mem::MaybeUninit;
const N: usize = 0x0000_7ff0_0000_0000;
pub fn g(n: &u8) {
let mut xs = MaybeUninit::<[u8; N]>::uninit();
}
pub fn main() {
let n = Box::new(27);
g(&n);
}
Originally reported as an ICE in https://github.com/rust-lang/rust/issues/149643. We no longer ICE, we now exit with a "proper" OOM error, but rustc still quits.
I'm surprised GVN does not have some kind of cap to ensure it doesn't consume excessive amounts of memory?
Cc @rust-lang/wg-mir-opt @cjgillot @saethlin
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.