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

ICE getting discriminant of #[repr(i128)] enum #43398

Closed
durka opened this issue Jul 21, 2017 · 3 comments · Fixed by #62994
Closed

ICE getting discriminant of #[repr(i128)] enum #43398

durka opened this issue Jul 21, 2017 · 3 comments · Fixed by #62994
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@durka
Copy link
Contributor

durka commented Jul 21, 2017

ICE occurs whether we use intrinsics::discriminant_value or mem::discriminant. cc #35118 #24263

STR

#![feature(core_intrinsics)]
#![feature(i128_type)]

#[repr(i128)]
enum Big { A, B }

fn main() {
    unsafe {
        println!("{} {:?}",
            std::intrinsics::discriminant_value(&Big::A),
            std::mem::discriminant(&Big::B));
    }
}

ICE

thread 'rustc' panicked at 'assertion failed: bits <= 64', src/librustc_trans/adt.rs:368:4
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_new
   5: rustc_trans::adt::load_discr
   6: rustc_trans::adt::trans_get_discr
   7: rustc_trans::intrinsic::trans_intrinsic_call
   8: rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_terminator
   9: rustc_trans::mir::trans_mir
  10: rustc_trans::trans_item::TransItem::define
  11: rustc_trans::base::trans_crate::module_translation
  12: rustc_trans::base::trans_crate
  13: rustc_driver::driver::phase_4_translate_to_llvm
  14: rustc_driver::driver::compile_input::{{closure}}
  15: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
  16: rustc_driver::driver::phase_3_run_analysis_passes
  17: rustc_driver::driver::compile_input
  18: rustc_driver::run_compiler
@Mark-Simulacrum Mark-Simulacrum added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels Jul 26, 2017
@varkor
Copy link
Member

varkor commented May 3, 2018

The updated example no longer ICEs.

@jakubadamw
Copy link
Contributor

@Mark-Simulacrum, this can be closed as it no longer ICEs.

@Mark-Simulacrum
Copy link
Member

Actually, presumably, E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jul 14, 2019
@varkor varkor added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Jul 15, 2019
iluuu1994 added a commit to iluuu1994/rust that referenced this issue Aug 5, 2019
pietroalbini added a commit to pietroalbini/rust that referenced this issue Aug 7, 2019
Centril added a commit to Centril/rust that referenced this issue Aug 8, 2019
Centril added a commit to Centril/rust that referenced this issue Aug 8, 2019
bors added a commit that referenced this issue Aug 8, 2019
Rollup of 7 pull requests

Successful merges:

 - #62994 (Add test for #43398)
 - #63259 (Add tests for some issues)
 - #63327 (doc: Reword deprecation message of MetadataExt::as_raw_stat)
 - #63331 (Test conditional initialization validation in async fns)
 - #63334 (Update to rustc-guide that passes toolstate)
 - #63353 (Update books)
 - #63360 (Use consistent capitalization in -C/-Z help)

Failed merges:

r? @ghost
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-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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.

4 participants