diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-05-18 18:44:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-18 18:44:14 +0200 |
| commit | e4e75688c2aaedbd0b6e863d3cb1dfc5d914e330 (patch) | |
| tree | cfbd0179cbfa7f734cf0ad353c0163293a6a90dd /tests/codegen | |
| parent | f9bf759e833f21edfa99ea63cc0fc57cf575227e (diff) | |
| parent | f60f2e8cb07d21b7d5b0fa7f96dacd2e806b98e4 (diff) | |
| download | rust-e4e75688c2aaedbd0b6e863d3cb1dfc5d914e330.tar.gz rust-e4e75688c2aaedbd0b6e863d3cb1dfc5d914e330.zip | |
Rollup merge of #125184 - scottmcm:fix-thin-ptr-ice, r=jieyouxu
Fix ICE in non-operand `aggregate_raw_ptr` intrinsic codegen Introduced in #123840 Found in #121571, cc `@clarfonthey`
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/intrinsics/aggregate-thin-pointer.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/codegen/intrinsics/aggregate-thin-pointer.rs b/tests/codegen/intrinsics/aggregate-thin-pointer.rs new file mode 100644 index 00000000000..aa3bf7e8b14 --- /dev/null +++ b/tests/codegen/intrinsics/aggregate-thin-pointer.rs @@ -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); +} |
