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
340 B
Rust
Raw Normal View History

2021-03-11 15:55:11 -06: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);
}