-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE: index out of bounds: the len is 0 but the index is 0' with --emit mir and mir-opt-level >1 #72181
Comments
Looks like this also happens in // run-pass
#![allow(dead_code)]
// compile-flags: -Zmir-opt-level=1
use std::mem;
#[derive(Copy, Clone)]
enum Never {}
union Foo {
a: u64,
b: Never
}
fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 }
fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x }
fn main() {
println!("{}", mem::size_of::<Foo>());
let f = [Foo { a: 42 }, Foo { a: 10 }];
println!("{:?}", unsafe { f[0].a });
} cmd: EDIT: backtrace:
|
Is this a regression? Looks like the backtrace points to |
Ah, but the original report is from before that PR. Not a regression then, or at least not caused by this PR. |
@matthiaskrgr could you post a backtrace for the second ICE? The first one was related to the |
backtrace:
|
Thanks, so that's inside |
Code
This miri test code
./src/tools/miri/tests/compile-fail/never_transmute_void.rs
Causes an ice when compiled with
-Zmir-opt-level=2 --emit mir
(but not with opt-level <2 or missing --emit mir)Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: