Skip to content

Broken MIR in encoding_rs related to MIR inlining + DestProp #105428

Closed
@saethlin

Description

@saethlin

This was originally #105344 (comment)


Trying to compile https://github.com/hsivonen/encoding_rs 5931e21bc20bad0335964f441da0c4309401107a with these flags:

$ RUSTFLAGS="-Zmir-opt-level=3 -Zvalidate-mir -Zinline-mir=yes" cargo +nightly test

Produces this:

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:1315 ~ encoding_rs[5e1f]::utf_16::{impl#0}::decode_to_utf16_raw), const_param_did: None }) (before pass SimplifyCfg-final) at bb218[0]:
                                encountered overlapping memory in `Call` terminator: _454 = bswap::<u16>(move _454) -> bb163
  --> src/utf_16.rs:85:21
   |
85 |                     dest.copy_utf16_from::<LittleEndian>(&mut source)
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:784:26

Removing -Zinline-mir=yes or -Zmir-opt-level=3 removes the ICE.


searched nightlies: from nightly-2022-01-01 to nightly-2022-12-05
regressed nightly: nightly-2022-11-28
searched commit range: 80a9646...1eb62b1
regressed commit: 0e9eee6

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --script script --start 2022-01-01 --end 2022-12-05 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions