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

miri: invalid enum discriminant value read #49777

Closed
bjorn3 opened this issue Apr 8, 2018 · 2 comments · Fixed by #49933
Closed

miri: invalid enum discriminant value read #49777

bjorn3 opened this issue Apr 8, 2018 · 2 comments · Fixed by #49933
Assignees

Comments

@bjorn3
Copy link
Member

bjorn3 commented Apr 8, 2018

When running it with priroda, the value for which the discriminant is read is 0xff

---- [ui] run-pass/issue-15523-big.rs stdout ----
	normalized stderr:
error[E0080]: constant evaluation error
  --> $DIR/issue-15523-big.rs:17:21
   |
17 | #[derive(PartialEq, PartialOrd)]
   |                     ^^^^^^^^^^ invalid enum discriminant value read
   |
note: inside call to `<Eu64 as std::cmp::PartialOrd>::partial_cmp`
  --> /home/bjorn/Documenten/rust2/src/libcore/cmp.rs:647:15
   |
647|         match self.partial_cmp(other) {
   |               ^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<Eu64 as std::cmp::PartialOrd>::lt`
  --> $DIR/issue-15523-big.rs:37:13
   |
37 |     assert!(Eu64::Pos2 < Eu64::PosMax);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `main`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:74:34
   |
74 |     lang_start_internal(&move || main().report(), argc, argv)
   |                                  ^^^^^^
note: inside call to `closure`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:59:75
   |
59 |             ::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
   |                                                                           ^^^^^^
note: inside call to `closure`
  --> /home/bjorn/Documenten/rust2/src/libstd/sys_common/backtrace.rs:136:5
   |
136|     f()
   |     ^^^
note: inside call to `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1/1:1802 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:59:13
   |
59 |             ::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `closure`
  --> /home/bjorn/Documenten/rust2/src/libstd/panicking.rs:306:40
   |
306|             ptr::write(&mut (*data).r, f());
   |                                        ^^^
note: inside call to `std::panicking::try::do_call::<[closure@DefId(1/1:1801 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>`
  --> /home/bjorn/Documenten/rust2/src/libstd/panicking.rs:302:5
   |
302| /     fn do_call<F: FnOnce() -> R, R>(data: *mut u8) {
303| |         unsafe {
304| |             let data = data as *mut Data<F, R>;
305| |             let f = ptr::read(&mut (*data).f);
306| |             ptr::write(&mut (*data).r, f());
307| |         }
308| |     }
   | |_____^
note: inside call to `std::panicking::try::<i32, [closure@DefId(1/1:1801 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>`
  --> /home/bjorn/Documenten/rust2/src/libstd/panic.rs:361:9
   |
361|         panicking::try(f)
   |         ^^^^^^^^^^^^^^^^^
note: inside call to `std::panic::catch_unwind::<[closure@DefId(1/1:1801 ~ std[a0b6]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:58:25
   |
58 |           let exit_code = panic::catch_unwind(|| {
   |  _________________________^
59 | |             ::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
60 | |         });
   | |__________^
note: inside call to `std::rt::lang_start_internal`
  --> /home/bjorn/Documenten/rust2/src/libstd/rt.rs:74:5
   |
74 |     lang_start_internal(&move || main().report(), argc, argv)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.

cc @oli-obk
blocking rust-lang/miri#364

@oli-obk
Copy link
Contributor

oli-obk commented Apr 8, 2018

0xFF is definitely missing some bytes. Do you have a dump that was run with RUST_LOG=rustc::mir::interpret?

@oli-obk oli-obk self-assigned this Apr 13, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Apr 13, 2018

I am working on this, just some bits that need cutting off.

bors added a commit that referenced this issue Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants