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

Compile panic on nightly compiling kamadak-exif, assertion failed in byteorder #50900

Closed
sindreij opened this issue May 19, 2018 · 4 comments · Fixed by #63067
Closed

Compile panic on nightly compiling kamadak-exif, assertion failed in byteorder #50900

sindreij opened this issue May 19, 2018 · 4 comments · Fixed by #63067
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: Writing correctness tests. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@sindreij
Copy link
Contributor

sindreij commented May 19, 2018

I hope this is not already known, but my searching has not turned up anything.

Compiling a rust binary with the kamadak-exif dependency panices in nightly.

How to reproduce:

  1. Create a new rust binary.
  2. Add kamadak-exif = "0.3.0" to dependencies in Cargo.toml
  3. Run RUST_BACKTRACE=1 cargo run

This gives the following output

   Compiling kamadak-exif v0.3.0
thread 'main' panicked at 'assertion failed: pack_size128(n as u128) <= nbytes && nbytes <= 16', /cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-1.2.2/src/lib.rs:2128:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:467
   6: std::panicking::begin_panic
   7: rustc::mir::interpret::write_target_uint
   8: <rustc_mir::interpret::memory::Memory<'a, 'mir, 'tcx, M>>::write_primval
   9: <rustc_mir::interpret::eval_context::EvalContext<'a, 'mir, 'tcx, M>>::write_value_to_ptr
  10: rustc_mir::interpret::const_eval::const_variant_index
  11: rustc_mir::hair::pattern::PatternContext::const_to_pat
  12: rustc_mir::hair::pattern::PatternContext::const_to_pat::{{closure}}
  13: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  14: rustc_mir::hair::pattern::PatternContext::const_to_pat
  15: rustc_mir::hair::pattern::PatternContext::lower_path
  16: rustc_mir::hair::pattern::PatternContext::lower_pattern
  17: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  19: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  20: rustc_mir::hair::pattern::_match::MatchCheckCtxt::create_and_enter
  21: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  22: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  23: rustc::hir::intravisit::walk_block
  24: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  25: rustc::hir::intravisit::walk_expr
  26: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  27: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_local
  28: rustc::hir::intravisit::walk_block
  29: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  30: rustc::hir::intravisit::walk_block
  31: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  32: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_body
  33: rustc::session::Session::track_errors
  34: rustc_mir::hair::pattern::check_match::check_match
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc::ty::context::tls::with_related_context
  37: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  38: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  39: rustc::hir::intravisit::Visitor::visit_nested_body
  40: rustc::hir::Crate::visit_all_item_likes
  41: rustc_mir::hair::pattern::check_match::check_crate
  42: rustc::util::common::time
  43: rustc::ty::context::tls::enter_context
  44: <std::thread::local::LocalKey<T>>::with
  45: rustc::ty::context::TyCtxt::create_and_enter
  46: rustc_driver::driver::compile_input
  47: rustc_driver::run_compiler_with_pool
  48: syntax::with_globals
  49: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  50: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  51: rustc_driver::run
  52: rustc_driver::main
  53: std::rt::lang_start::{{closure}}
  54: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  55: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  56: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:374
             at libstd/rt.rs:58
  57: main
  58: __libc_start_main
  59: <unknown>
query stack during panic:
#0 [check_match] processing `tiff::parse_ifd`
end of query stack

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.28.0-nightly (952f344cd 2018-05-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 --crate-type lib

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

error: Could not compile `kamadak-exif`.

To learn more, run the command again with --verbose.

It compiles on stable and beta.

Edit: Just running cargo build in https://github.com/kamadak/exif-rs gives the same result.

Meta

$ rustc --version --verbose
rustc 1.28.0-nightly (952f344cd 2018-05-18)
binary: rustc
commit-hash: 952f344cdc0bca58d9f6c54dcfbae0890246e886
commit-date: 2018-05-18
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0
@sindreij
Copy link
Contributor Author

sindreij commented May 19, 2018

Tried a few different nightlies. And it looks like it broke sometime between rustc 1.27.0-nightly (acd3871ba 2018-05-10) and rustc 1.27.0-nightly (ff2ac35db 2018-05-12)

This works

$ rustc --version --verbose
rustc 1.27.0-nightly (acd3871ba 2018-05-10)
binary: rustc
commit-hash: acd3871ba17316419c644e17547887787628ec2f
commit-date: 2018-05-10
host: x86_64-unknown-linux-gnu
release: 1.27.0-nightly
LLVM version: 6.0

This panics

$ rustc --version --verbose
rustc 1.27.0-nightly (ff2ac35db 2018-05-12)
binary: rustc
commit-hash: ff2ac35db93a80b2de5daa4f280bf1503d62c164
commit-date: 2018-05-12
host: x86_64-unknown-linux-gnu
release: 1.27.0-nightly
LLVM version: 6.0

@sindreij
Copy link
Contributor Author

sindreij commented May 19, 2018

I have managed to get a much smaller example. Compiling this on nightly gives the above panic:

#[derive(PartialEq, Eq)]
pub struct Tag(pub Context, pub u16);

#[derive(PartialEq, Eq)]
pub enum Context {
    Tiff,
    Exif,
}

impl Tag {
    const ExifIFDPointer: Tag = Tag(Context::Tiff, 34665);
}

fn main() {
    match Tag::ExifIFDPointer {
        Tag::ExifIFDPointer => {}
    }
}

@kennytm kennytm added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels May 20, 2018
@sindreij
Copy link
Contributor Author

Looks like it's fixed in the newest nightly (rustc 1.28.0-nightly (a3085756e 2018-05-19))

@kennytm
Copy link
Member

kennytm commented May 20, 2018

Bisecting between acd3871...ff2ac35 gives #50249 as the regression PR.

@kennytm kennytm added the E-needs-test Call for participation: Writing correctness tests. label May 20, 2018
Centril added a commit to Centril/rust that referenced this issue Jul 28, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: Writing correctness tests. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants