Auto merge of #78253 - Aaron1011:bump-llvm-deadarg, r=cuviper
Bump LLVM for DeadArgElim fix Fixes #76387 Pulls in https://github.com/rust-lang/llvm-project/pull/82
This commit is contained in:
commit
430feb24a4
@ -1 +1 @@
|
||||
Subproject commit 655a1467c98741e332b87661a9046877077ef4dc
|
||||
Subproject commit ee1617457899ef2eb55dcf7ee2758b4340b6533f
|
29
src/test/ui/auxiliary/issue-76387.rs
Normal file
29
src/test/ui/auxiliary/issue-76387.rs
Normal file
@ -0,0 +1,29 @@
|
||||
// compile-flags: -C opt-level=3
|
||||
|
||||
pub struct FatPtr {
|
||||
ptr: *mut u8,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl FatPtr {
|
||||
pub fn new(len: usize) -> FatPtr {
|
||||
let ptr = Box::into_raw(vec![42u8; len].into_boxed_slice()) as *mut u8;
|
||||
|
||||
FatPtr { ptr, len }
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for FatPtr {
|
||||
type Target = [u8];
|
||||
|
||||
#[inline]
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe { std::slice::from_raw_parts(self.ptr, self.len) }
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Drop for FatPtr {
|
||||
fn drop(&mut self) {
|
||||
println!("Drop");
|
||||
}
|
||||
}
|
22
src/test/ui/issue-76387-llvm-miscompile.rs
Normal file
22
src/test/ui/issue-76387-llvm-miscompile.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// no-system-llvm
|
||||
// compile-flags: -C opt-level=3
|
||||
// aux-build: issue-76387.rs
|
||||
// run-pass
|
||||
|
||||
// Regression test for issue #76387
|
||||
// Tests that LLVM doesn't miscompile this
|
||||
|
||||
extern crate issue_76387;
|
||||
|
||||
use issue_76387::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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user