about summary refs log tree commit diff
path: root/tests/codegen/asm-sanitize-llvm.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-31 15:29:14 +0000
committerbors <bors@rust-lang.org>2024-10-31 15:29:14 +0000
commita0d98ff0e5b6e1f2c63fd26f68484792621b235c (patch)
tree32e8f29a957bb04dffa50327ea8a3901f1486f31 /tests/codegen/asm-sanitize-llvm.rs
parent20c909ff9cdd88d33768a4ddb8952927a675b0ad (diff)
parentcfb4c05d77df4a6bcc53924eddb3a35102b65da9 (diff)
downloadrust-a0d98ff0e5b6e1f2c63fd26f68484792621b235c.tar.gz
rust-a0d98ff0e5b6e1f2c63fd26f68484792621b235c.zip
Auto merge of #132356 - jieyouxu:unsound-simplify_aggregate_to_copy, r=cjgillot,DianQK
Mark `simplify_aggregate_to_copy` mir-opt as unsound

Mark the `simplify_aggregate_to_copy` mir-opt added in #128299 as unsound as it seems to miscompile the MCVE reported in https://github.com/rust-lang/rust/issues/132353. The mir-opt can be re-enabled once this case is fixed.

```rs
fn pop_min(mut score2head: Vec<Option<usize>>) -> Option<usize> {
    loop {
        if let Some(col) = score2head[0] {
            score2head[0] = None;
            return Some(col);
        }
    }
}

fn main() {
    let min = pop_min(vec![Some(1)]);
    println!("min: {:?}", min);
    // panic happens here on beta in release mode
    // but not in debug mode
    min.unwrap();
}
```

This MCVE is included as a `run-pass` ui regression test in the first commit. I built the ui test with a nightly manually, and can reproduce the behavioral difference with `-C opt-level=0` and `-C opt-level=1`. Locally, this ui test will fail unless it was run on a compiler built with the second commit marking the mir-opt as unsound thus disabling it by default.

This PR **partially reverts** commit e7386b3, reversing changes made to 02b1be1. The mir-opt implementation is just marked as unsound but **not** reverted to make reland reviews easier. Test changes are **reverted if they were not pure additions**. Tests added by the original PR received `-Z unsound-mir-opts` compile-flags.

cc `@DianQK` `@cjgillot` (PR author and reviewer of #128299)
Diffstat (limited to 'tests/codegen/asm-sanitize-llvm.rs')
0 files changed, 0 insertions, 0 deletions