rust/tests/ui/codegen/issue-82859-slice-miscompile.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
342 B
Rust
Raw Normal View History

2021-03-11 21:55:11 +00:00
//@ run-pass
//@ compile-flags: -Copt-level=0 -Cdebuginfo=2
// Make sure LLVM does not miscompile this.
fn indirect_get_slice() -> &'static [usize] {
&[]
}
#[inline(always)]
fn get_slice() -> &'static [usize] {
let ret = indirect_get_slice();
ret
}
fn main() {
let output = get_slice().len();
assert_eq!(output, 0);
}