Skip to content

Broken MIR (debug info?) with mir-opt-level=2 #66077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RalfJung opened this issue Nov 4, 2019 · 2 comments
Closed

Broken MIR (debug info?) with mir-opt-level=2 #66077

RalfJung opened this issue Nov 4, 2019 · 2 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented Nov 4, 2019

Miri sometimes ICEs when printing the backtrace of a failure with mir-opt-level=2:

RUST_BACKTRACE=1 ./miri run tests/compile-fail/deallocate-twice.rs -Zmir-opt-level=2

gives

  15: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:96
  16: <usize as core::slice::SliceIndex<[T]>>::index
             at /rustc/cba93685377bc74a2fde1eb8e7a086039b038e94/src/libcore/slice/mod.rs:2796
  17: core::slice::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/cba93685377bc74a2fde1eb8e7a086039b038e94/src/libcore/slice/mod.rs:2647
  18: <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index
             at /rustc/cba93685377bc74a2fde1eb8e7a086039b038e94/src/liballoc/vec.rs:1861
  19: <rustc_index::vec::IndexVec<I,T> as core::ops::index::Index<I>>::index
             at /rustc/cba93685377bc74a2fde1eb8e7a086039b038e94/src/librustc_index/vec.rs:740
  20: rustc_mir::interpret::eval_context::InterpCx<M>::generate_stacktrace
             at /rustc/cba93685377bc74a2fde1eb8e7a086039b038e94/src/librustc_mir/interpret/eval_context.rs:755
  21: miri::eval::eval_main
             at src/eval.rs:225
  22: <miri::MiriCompilerCalls as rustc_driver::Callbacks>::after_analysis::{{closure}}
             at src/bin/miri.rs:52

What happens here is that the following indexing operation is out-of-bounds:

mir::ClearCrossCrate::Set(ref ivs) => Some(ivs[source_info.scope].lint_root),

This looks like broken MIR to me.

(This is not a new error, but somehow it seems I did not report it when this started happening quite a while ago.)

Cc @oli-obk @eddyb @wesleywiser

@Centril Centril added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-testsuite Area: The testsuite used to check the correctness of rustc labels Nov 5, 2019
@Aaron1011
Copy link
Member

@RalfJung: This is a bug in MIR inlining. I've opened an issue: #66137

@RalfJung
Copy link
Member Author

RalfJung commented Nov 6, 2019

Closing in favor of #66137 then.

@RalfJung RalfJung closed this as completed Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants