Skip to content

powerpc: ICE when taking and returning C struct containing u64 #47278

Closed
@hanna-kruppe

Description

@hanna-kruppe

This code, when compiled for powerpc-unknown-linux-gnu, results in an ICE:

#[repr(C)]
pub struct Foo(u64);

pub extern fn foo(_: Foo) -> Foo { loop {} }

Putting smaller integers in Foo does not trigger this, even if you use a ton of them. Edit: It also does not occur when taking it only as argument, or when only returning it.

Panic message and backtrace:

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.25.0-nightly (ee220daca 2018-01-07) running on x86_64-pc-windows-msvc

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'out of bounds argument access: 3 out of 3 arguments', librustc_llvm\lib.rs:269:9
stack backtrace:
   0: std::sync::mpsc::sync::Queue::dequeue
   1: std::panicking::Location::column
   2: std::panicking::Location::column
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_fmt
   5: std::panicking::begin_panic_fmt
   6: rustc_llvm::get_param
   7: <rustc_trans::abi::CastTarget as core::convert::From<rustc_trans::abi::Uniform>>::from
   8: <rustc_trans::cabi_x86_64::Class as core::fmt::Debug>::fmt
   9: <rustc_trans::mir::analyze::CleanupKind as core::fmt::Debug>::fmt
  10: rustc_trans::base::trans_instance
  11: <rustc_trans::mir::analyze::LocalAnalyzer<'mir, 'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_local
  12: rustc_trans::base::trans_crate
  13: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::ensure
  14: rustc::dep_graph::graph::DepGraph::in_ignore
  15: rustc::util::ppaux::<impl core::fmt::Debug for rustc::ty::Predicate<'tcx>>::fmt
  16: <rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx> as rustc::ty::layout::HasTyCtxt<'gcx>>::tcx
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::ensure
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::try_get
  19: rustc::ty::maps::TyCtxtAt::compile_codegen_unit
  20: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::compile_codegen_unit
  21: rustc_trans::base::trans_crate
  22: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
  23: rustc_driver::driver::default_provide_extern
  24: <rustc_driver::monitor::Sink as std::io::Write>::flush
  25: <rustc_driver::monitor::Sink as std::io::Write>::flush
  26: <rustc_driver::monitor::Sink as std::io::Write>::flush
  27: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item
  28: rustc_driver::driver::compile_input
  29: rustc_driver::run_compiler
  30: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  31: _rust_maybe_catch_panic
  32: <log::NopLogger as log::Log>::enabled
  33: std::sync::mpsc::sync::Queue::dequeue
  34: std::sys::windows::thread::Thread::new
  35: BaseThreadInitThunk

error: Could not compile `abi-test`.

Rust version:

rustc 1.25.0-nightly (ee220daca 2018-01-07)
binary: rustc
commit-hash: ee220daca345302c3277befee2732b6b2a5a711c
commit-date: 2018-01-07
host: x86_64-pc-windows-msvc
release: 1.25.0-nightly
LLVM version: 4.0

cc @eddyb

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-PowerPCTarget: PowerPC processorsP-highHigh priorityregression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions