forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#125184 - scottmcm:fix-thin-ptr-ice, r=jieyouxu Fix ICE in non-operand `aggregate_raw_ptr` intrinsic codegen Introduced in rust-lang#123840 Found in rust-lang#121571, cc `@clarfonthey`
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ compile-flags: -O -C no-prepopulate-passes -Z mir-enable-passes=-InstSimplify | ||
//@ only-64bit (so I don't need to worry about usize) | ||
|
||
#![crate_type = "lib"] | ||
#![feature(core_intrinsics)] | ||
|
||
use std::intrinsics::aggregate_raw_ptr; | ||
|
||
// InstSimplify replaces these with casts if it can, which means they're almost | ||
// never seen in codegen, but PR#121571 found a way, so add a test for it. | ||
|
||
#[inline(never)] | ||
pub fn opaque(_p: &*const i32) {} | ||
|
||
// CHECK-LABEL: @thin_ptr_via_aggregate( | ||
#[no_mangle] | ||
pub unsafe fn thin_ptr_via_aggregate(p: *const ()) { | ||
// CHECK: %mem = alloca | ||
// CHECK: store ptr %p, ptr %mem | ||
// CHECK: call {{.+}}aggregate_thin_pointer{{.+}} %mem) | ||
let mem = aggregate_raw_ptr(p, ()); | ||
opaque(&mem); | ||
} |