NormalizeArrayLen
MIR opt unsound due to missed writes
#105929
Labels
A-mir-opt
Area: MIR optimizations
C-bug
Category: This is a bug.
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The opt, as written today, will miscompile something that looks like this:
The bug is roughly on this line:
rust/compiler/rustc_mir_transform/src/normalize_array_len.rs
Line 270 in 696563e
This makes an attempt to detect other writes to the
slice_ptr
local, but it misses a lot of cases. Taking a reference like in the example above is an easy one, butSetDiscriminant
is also missed, as well as writes to any aliasing pointers.As far as I can tell this needs
Rvalue::Cast
support in custom MIR to reproduce.@rustbot label A-mir-opt T-compiler requires-nightly
The text was updated successfully, but these errors were encountered: