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

Many attempted to read undefined bytes errors with miri #51086

Closed
bjorn3 opened this issue May 26, 2018 · 4 comments
Closed

Many attempted to read undefined bytes errors with miri #51086

bjorn3 opened this issue May 26, 2018 · 4 comments

Comments

@bjorn3
Copy link
Member

bjorn3 commented May 26, 2018

error: attempted to read undefined bytes

ERROR 2018-05-26T14:44:50Z: rustc_mir::interpret::eval_context: 

An error occurred in miri:
backtrace frames: 27
0: backtrace::backtrace::trace::h85503c2e4e338460
	at <unknown_file>
1: backtrace::capture::Backtrace::new_unresolved::h51246d60a53a8bdc
	at <unknown_file>
2: _$LT$rustc..mir..interpret..error..EvalError$LT$$u27$tcx$GT$$u20$as$u20$core..convert..From$LT$rustc..mir..interpret..error..EvalErrorKind$LT$$u27$tcx$C$$u20$u64$GT$$GT$$GT$::from::h4d30d3209764fd49
	at <unknown_file>
3: rustc::mir::interpret::value::Scalar::to_bits::h85909ebea5cc3804
	at <unknown_file>
4: rustc_mir::interpret::terminator::_$LT$impl$u20$rustc_mir..interpret..eval_context..EvalContext$LT$$u27$a$C$$u20$$u27$mir$C$$u20$$u27$tcx$C$$u20$M$GT$$GT$::eval_terminator::h69abb3bb79aab288
	at /Users/travis/build/rust-lang/rust/src/librustc_mir/interpret/terminator/mod.rs:47
5: rustc_mir::interpret::step::_$LT$impl$u20$rustc_mir..interpret..eval_context..EvalContext$LT$$u27$a$C$$u20$$u27$mir$C$$u20$$u27$tcx$C$$u20$M$GT$$GT$::terminator::hdd1ce4d831f07250
	at /Users/travis/build/rust-lang/rust/src/librustc_mir/interpret/step.rs:109
6: rustc_mir::interpret::step::_$LT$impl$u20$rustc_mir..interpret..eval_context..EvalContext$LT$$u27$a$C$$u20$$u27$mir$C$$u20$$u27$tcx$C$$u20$M$GT$$GT$::step::h7b4b7c429541cd9b
	at /Users/travis/build/rust-lang/rust/src/librustc_mir/interpret/step.rs:43
7: miri::eval_main::run_main::h9c72be881571a562
	at src/lib.rs:232
8: miri::eval_main::h9d8ab3b0d25eb037
	at src/lib.rs:245
9: miri::after_analysis::h1dc1a8379cb87900
	at src/bin/miri.rs:147
10: _$LT$miri..MiriCompilerCalls$u20$as$u20$rustc_driver..CompilerCalls$LT$$u27$a$GT$$GT$::build_controller::_$u7b$$u7b$closure$u7d$$u7d$::hbed7da9498dc169f
	at src/bin/miri.rs:88
11: rustc::ty::context::tls::with_context::h434a73bf87917666
	at <unknown_file>
12: rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::h54692425a596d732
	at <unknown_file>
13: rustc::ty::context::tls::enter_context::hdfa81ea4757b9ad4
	at <unknown_file>
14: _$LT$std..thread..local..LocalKey$LT$T$GT$$GT$::with::hfbf5029193cab3f2
	at <unknown_file>
15: rustc::ty::context::TyCtxt::create_and_enter::hfc13991376fb466d
	at <unknown_file>
16: rustc_driver::driver::compile_input::he7ba295ba0b6472f
	at <unknown_file>
17: rustc_driver::run_compiler_with_pool::h39dace11c41da12a
	at <unknown_file>
18: syntax::with_globals::h39d73970aba4a7ab
	at <unknown_file>
19: rustc_driver::run_compiler::hf76541365053c7e0
	at <unknown_file>
20: miri::main::hd88a1c4b352e05a3
	at src/bin/miri.rs:237
21: std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hf5b1442a7c729874
	at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
22: std::panicking::try::do_call::hfd75cf9e05cc5943 (.llvm.9696875478146817961)
	at <unknown_file>
23: __rust_maybe_catch_panic
	at <unknown_file>
24: std::rt::lang_start_internal::h36f7afe722d0078f
	at <unknown_file>
25: std::rt::lang_start::he4af6349eec3f416
	at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
26: main
	at <unknown_file>

error[E0080]: constant evaluation error
   --> /Users/bjorn/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/result.rs:747:13
    |
747 |             Ok(t) => t,
    |             ^^^^^ attempted to read undefined bytes
    |
note: inside call to `<std::result::Result<T, E>><(), std::collections::CollectionAllocErr>::unwrap_or_else::<[closure@DefId(4/1:226 ~ alloc[e00a]::raw_vec[0]::{{impl}}[0]::allocate_in[0]::{{closure}}[1])]>`
   --> /Users/bjorn/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc/raw_vec.rs:92:13
    |
92  |             alloc_guard(alloc_size).unwrap_or_else(|_| capacity_overflow());
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<alloc::raw_vec::RawVec<T, A>><(), std::heap::Global>::allocate_in`
   --> /Users/bjorn/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc/raw_vec.rs:146:9
    |
146 |         RawVec::allocate_in(cap, false, Global)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<alloc::raw_vec::RawVec<T>><()>::with_capacity`
   --> /Users/bjorn/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc/vec.rs:362:18
    |
362 |             buf: RawVec::with_capacity(capacity),
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<std::vec::Vec<T>><()>::with_capacity`
   --> /Users/bjorn/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc/binary_heap.rs:342:28
    |
342 |         BinaryHeap { data: Vec::with_capacity(capacity) }
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<std::collections::BinaryHeap<T>><()>::with_capacity`
   --> tests/run-pass/zero-sized-binary-heap-push.rs:18:26
    |
18  |         let mut tester = BinaryHeap::with_capacity(len);
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@bjorn3
Copy link
Member Author

bjorn3 commented May 28, 2018

cc @oli-obk

@bjorn3
Copy link
Member Author

bjorn3 commented May 28, 2018

Error is at

let mut target_block = targets[targets.len() - 1];
for (index, &const_int) in values.iter().enumerate() {
if discr_prim.to_bits(self.layout_of(discr_val.ty).unwrap().size)? == const_int {

@bjorn3
Copy link
Member Author

bjorn3 commented May 30, 2018

According to priroda discr_prim has 8 bits of defined bytes. And it has the type isize, which has 64 bits.

@bjorn3
Copy link
Member Author

bjorn3 commented May 30, 2018

#50967 (review)

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

No branches or pull requests

1 participant