Skip to content
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

Internal Compiler Error on test program with unstable unsize feature #1664

Closed
teryror opened this issue Jan 3, 2021 · 2 comments
Closed
Labels
A-validation Area: This affects enforcing the validity invariant, and related UB checking C-bug Category: This is a bug. I-ICE Impact: makes Miri crash with some ICE

Comments

@teryror
Copy link
Contributor

teryror commented Jan 3, 2021

I was experimenting with feature(unsize) and min_const_generics on the playground, and managed to crash Miri; the error message says to report to the rust repository, but the code builds and runs just fine, only attempting to run it with Miri leads to an ICE. In fact, the crash definitely happens during interpretation, as my original program managed to output some text before the error occured.

Playground Link

Some observations:

  • Removing the _ptr field (and replacing it with PhantomData to make the change minimal and still compile) causes Miri to (presumably) correctly detect undefined behavior and terminate normally.
  • Removing the ptr.write statement in line 29 causes Miri to terminate without any error.

Given that, I don't know how to minimize the example any further, so I'm not sure how strongly this is actually related to my use of the nightly-only features. I left the comments in there to leave you a bit of context on what I was actually trying to do, in case that's helpful somehow.

The error message:

   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s
     Running `/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri target/x86_64-unknown-linux-gnu/debug/playground`
error: internal compiler error: /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e/compiler/rustc_mir/src/interpret/validity.rs:922:17: Unexpected error during validation: unable to turn pointer into raw bytes

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (44e3daf5e 2020-12-31) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z miri-disable-isolation -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: aborting due to previous error
@RalfJung
Copy link
Member

RalfJung commented Jan 3, 2021

Thanks for the report! Reporting Miri bugs in the Miri repo is okay, we just don't have a good way to adjust that ICE message. :)

In this particular case, however, I think this is a duplicate of rust-lang/rust#79690. The ICE message is the same, and I am not surprised that it is possible to trigger that ICE from Miri.

@RalfJung RalfJung added A-validation Area: This affects enforcing the validity invariant, and related UB checking C-bug Category: This is a bug. I-ICE Impact: makes Miri crash with some ICE labels Jan 3, 2021
@teryror
Copy link
Contributor Author

teryror commented Jan 3, 2021

That does indeed look familiar! I didn't think to check the rust repo for duplicates of Miri issues, sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-validation Area: This affects enforcing the validity invariant, and related UB checking C-bug Category: This is a bug. I-ICE Impact: makes Miri crash with some ICE
Projects
None yet
Development

No branches or pull requests

2 participants