mirror of
https://github.com/Noratrieb/rlo-issue-112061.git
synced 2026-01-14 08:25:03 +01:00
ub
This commit is contained in:
parent
6c17c4cf53
commit
4cb3422daf
3 changed files with 5 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,6 +2,7 @@
|
|||
/bad
|
||||
*.ll
|
||||
*.s
|
||||
*.bc
|
||||
a.out
|
||||
|
||||
# Added by cargo
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -eu
|
||||
|
||||
# rustc code.rs --crate-name ll -Zmir-enable-passes=-ConstProp --emit llvm-ir -Cno-prepopulate-passes --crate-type=lib
|
||||
rustc code.rs --crate-name ll -Zmir-enable-passes=-ConstProp --emit llvm-ir -Cno-prepopulate-passes --crate-type=lib
|
||||
|
||||
d=$(mktemp -d)
|
||||
|
||||
|
|
@ -18,4 +18,4 @@ if [ "$good" != "$bad" ]; then
|
|||
else
|
||||
echo "no repro"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
4
code.rs
4
code.rs
|
|
@ -19,7 +19,7 @@ pub unsafe extern "C" fn fn12_rs() {
|
|||
'l0: loop {
|
||||
let mut v20 = [197_u8; 8];
|
||||
let v20_ptr = ptr::addr_of_mut!(v20);
|
||||
let mut v12: *mut u8 = core::ptr::addr_of_mut!((*v20_ptr)[v9]);
|
||||
let mut v12: *mut u8 = v20_ptr.cast::<u8>().add(v9);
|
||||
v9 = 2_usize; // unused but necessary write
|
||||
loop {
|
||||
// only runs once, but necessary
|
||||
|
|
@ -64,7 +64,7 @@ pub unsafe extern "C" fn fn12_rs() {
|
|||
}
|
||||
_ => {
|
||||
// Dead code but necessary
|
||||
v12 = core::ptr::addr_of_mut!((*v20_ptr)[2]);
|
||||
v12 = (*v20_ptr).as_mut_ptr().add(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue