-
-
Notifications
You must be signed in to change notification settings - Fork 15k
CopyProp doesn't always respect Tree Borrows #141122
Copy link
Copy link
Closed
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsA-rustlantisArea: A miscompilation found by RustlantisArea: A miscompilation found by RustlantisC-bugCategory: This is a bug.Category: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeIssue: Correct Rust code lowers to incorrect machine codeI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsA-rustlantisArea: A miscompilation found by RustlantisArea: A miscompilation found by RustlantisC-bugCategory: This is a bug.Category: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeIssue: Correct Rust code lowers to incorrect machine codeI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Reduced example from rustlantis, which is accepted by Miri using Tree Borrows without optimizations enabled:
If I run this under Miri with
-Zmir-enable-passes=+CopyProp, I see:The MIR diff for CopyProp is
fn main() -> () { let mut _0: (); let mut _1: *const char; let mut _2: char; let mut _3: char; let mut _4: char; let mut _5: char; let mut _6: &char; let mut _7: (); bb0: { _1 = &raw const _2; _3 = const 'b'; _5 = copy _3; _6 = &_3; - _4 = copy _5; + _3 = copy _5; (*_1) = copy (*_6); _6 = &_5; - _7 = dump_var::<char>(copy _4) -> [return: bb1, unwind unreachable]; + _7 = dump_var::<char>(copy _3) -> [return: bb1, unwind unreachable]; } bb1: { return; } }