This commit is contained in:
nora 2023-05-30 15:51:17 +02:00
parent bd061d4afe
commit ad97b16726
2 changed files with 31 additions and 33 deletions

View file

@ -1,12 +1,12 @@
#/usr/bin/env bash
rustc code.rs --crate-name bad -Zmir-enable-passes=-ConstProp
rustc code.rs --crate-name good -Zmir-enable-passes=+ConstProp
rustc code.rs --crate-name bad -Zmir-enable-passes=-ConstProp -Copt-level=3
rustc code.rs --crate-name good -Zmir-enable-passes=+ConstProp -Copt-level=3
bad=$(./bad)
good=$(./good)
if [ good != bad ]; then
if [ "$good" != "$bad" ]; then
echo "MISCOMPILATION"
else
echo "no repro"

58
code.rs
View file

@ -10,8 +10,8 @@ pub unsafe fn fn12_rs() {
let mut v21: [u8; 8];
let mut v31: (bool, u8, usize, f32) = Default::default();
let mut v33: ([u128; 7], *mut i8, *mut bool) = ([0; 7], ptr::null_mut(), ptr::null_mut());
let mut v39_0: usize = 0;
let mut v39: (usize, [u128; 7], ([u32; 6], usize, *mut [u32; 6])) =
(0, [0; 7], ([0; 6], 0, ptr::null_mut()));
let ret: *mut bool = core::ptr::addr_of_mut!(v2);
'l0: loop {
@ -25,40 +25,38 @@ pub unsafe fn fn12_rs() {
// Taken
v8 = 13978819448286864680_u64;
v33.2 = ret;
match v39_0 {
0 => {
// Taken
'l2: loop {
(*v20_ptr) = [11_u8; 8]; // What LLVM with low mir-opt prints
(*v12) = 22; // What Miri prints
loop {
v21 = *v20_ptr;
match v8 {
13978819448286864680 => {
// Taken
v8 = 2;
v39_0 = 6;
v17 = v33.2;
v33.2 = core::ptr::addr_of_mut!(v31.0);
v31.1 = *v12;
(*v17) = true;
(*v20_ptr) = v21;
match v39_0 {
6 => {
// Taken
print_var(v31.1);
}
0 => continue 'l2,
_ => return,
{
// Taken
'l2: loop {
(*v20_ptr) = [11_u8; 8]; // What LLVM with low mir-opt prints
(*v12) = 22; // What Miri prints
loop {
v21 = *v20_ptr;
match v8 {
13978819448286864680 => {
// Taken
v39.2 .0 = [2262110980_u32; 6];
v8 = 2;
v39.0 = 6;
v17 = v33.2;
v33.2 = core::ptr::addr_of_mut!(v31.0);
v31.1 = *v12;
(*v17) = true;
(*v20_ptr) = v21;
match v39.0 {
6 => {
// Taken
print_var(v31.1);
}
0 => continue 'l2,
_ => return,
}
2 => return,
_ => continue 'l0,
}
2 => return,
_ => continue 'l0,
}
}
}
_ => return,
}
}
4 => {