moroso / compiler

The compiler for the Moroso project.
4 stars 3 forks source link

ICE in typechecker #37

Closed mrwright closed 8 years ago

mrwright commented 10 years ago
fn main() -> u32 {
    let s: *u8 = 0 as *u8;
    let t = *(&s as u8 + 3);

    0
}

This is not well-typed, but it should print a type error. Instead it has an ICE:

task '<main>' failed at 'internal error: entered unreachable code', src/typechecker.rs:771
stack backtrace:
   1:     0x7f6bf0f0eda0 - rt::backtrace::imp::write::h2626651a2fc94766OLq
   2:     0x7f6bf0f11d90 - failure::on_fail::h03ed7212d81a2db7w7q
   3:     0x7f6bf0f21500 - unwind::begin_unwind_inner::hf47eb3d89161428crje
   4:     0x7f6bf0a00b80 - unwind::begin_unwind::h422749655183734816
   5:     0x7f6bf0a09e80 - typechecker::Typechecker<'a>::expr_to_ty::hc5ae88c33eb50683w6c
   6:     0x7f6bf0a16e30 - typechecker::Typechecker<'a>::block_to_ty::h4332730153b79d2enGd
   7:     0x7f6bf0a1fa10 - typechecker::Typechecker<'a>.Visitor::visit_item::closure.33696
   8:     0x7f6bf0a12240 - typechecker::Typechecker<'a>::with_generics::h2646355133747685451
   9:     0x7f6bf0a04e60 - typechecker::Typechecker<'a>.Visitor::visit_item::h6d83b4e8824299c5jee
  10:     0x7f6bf0a043c0 - typechecker::Typechecker<'a>::typecheck::h2648d77ca069b5b25Hc
  11:     0x7f6bf0b9d0a0 - mc::main::hd765d4b4ec89fe2eeZF
  12:     0x7f6bf0bf6fd0 - start::closure.8431
  13:     0x7f6bf0f22250 - rust_try_inner
  14:     0x7f6bf0f22240 - rust_try
  15:     0x7f6bf0f1f780 - unwind::try::h2d20ff3e4d5ebe36H7d
  16:     0x7f6bf0f1f550 - task::Task::run::h6c06266aca975e6cNdd
  17:     0x7f6bf0bf6d00 - start::h0795d18d071ca9e5soe
  18:     0x7f6bf0bf6c70 - lang_start::h1b3ea2e9962b8f3fLne
  19:     0x7f6bef573a50 - __libc_start_main
  20:     0x7f6bf09fb1f8 - <unknown>
  21:                0x0 - <unknown>
mrwright commented 8 years ago

Closed by https://github.com/moroso/compiler/commit/ea86435977f652cae857dd24f7e2b476a5e05cb7