about summary refs log tree commit diff
path: root/tests/ui/cross-crate/llvm-miscompile-MarkValue-MaybeLive.rs
blob: 95d022ddd96ebbc15e0dfc9cb1181901656ea522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! Regression test for <https://github.com/rust-lang/rust/issues/76387>
//! Tests that LLVM doesn't miscompile this
//! See upstream fix: <https://reviews.llvm.org/D88529>.

//@ compile-flags: -C opt-level=3
//@ aux-build: llvm-miscompile-MarkValue-MaybeLive.rs
//@ run-pass

extern crate llvm_miscompile_MarkValue_MaybeLive;

use llvm_miscompile_MarkValue_MaybeLive::FatPtr;

fn print(data: &[u8]) {
    println!("{:#?}", data);
}

fn main() {
    let ptr = FatPtr::new(20);
    let data = unsafe { std::slice::from_raw_parts(ptr.as_ptr(), ptr.len()) };

    print(data);
}