Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fdaaf86

Browse files
add align attr to addr-of-mutate test
1 parent 0f7d333 commit fdaaf86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/codegen/addr-of-mutate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Test for the absence of `readonly` on the argument when it is mutated via `&raw const`.
77
// See <https://github.com/rust-lang/rust/issues/111502>.
88

9-
// CHECK: i8 @foo(ptr noalias nocapture noundef dereferenceable(128) %x)
9+
// CHECK: i8 @foo(ptr noalias nocapture noundef align 1 dereferenceable(128) %x)
1010
#[no_mangle]
1111
pub fn foo(x: [u8; 128]) -> u8 {
1212
let ptr = core::ptr::addr_of!(x).cast_mut();
@@ -16,7 +16,7 @@ pub fn foo(x: [u8; 128]) -> u8 {
1616
x[0]
1717
}
1818

19-
// CHECK: i1 @second(ptr noalias nocapture noundef dereferenceable({{[0-9]+}}) %a_ptr_and_b)
19+
// CHECK: i1 @second(ptr noalias nocapture noundef align {{[0-9]+}} dereferenceable({{[0-9]+}}) %a_ptr_and_b)
2020
#[no_mangle]
2121
pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool {
2222
let b_bool_ptr = core::ptr::addr_of!(a_ptr_and_b.1.1).cast_mut();
@@ -25,7 +25,7 @@ pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool {
2525
}
2626

2727
// If going through a deref (and there are no other mutating accesses), then `readonly` is fine.
28-
// CHECK: i1 @third(ptr noalias nocapture noundef readonly dereferenceable({{[0-9]+}}) %a_ptr_and_b)
28+
// CHECK: i1 @third(ptr noalias nocapture noundef readonly align {{[0-9]+}} dereferenceable({{[0-9]+}}) %a_ptr_and_b)
2929
#[no_mangle]
3030
pub unsafe fn third(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool {
3131
let b_bool_ptr = core::ptr::addr_of!((*a_ptr_and_b.0).1).cast_mut();

0 commit comments

Comments
 (0)