Skip to content

typecheck segfault on failure to unify #602

Closed

Description

@paulstansifer

The type error makes this segfault:

use std;
import std::option::*;

fn main() {
  let t[int] x = none;
  x = 5;
}

Looks like stack overflow. The interesting part of the backtrace:
#1019 0x080df952 in middle::ty::fold_ty ()
#1020 0x080f985f in middle::ty::unify::fixup_vars::subst_vars ()
#1021 0x0827bc13 in middle::ty::unify::fixup_vars::subst_vars::thunk3323 ()
#1022 0x080e3e7f in middle::ty::fold_ty ()
#1023 0x080df952 in middle::ty::fold_ty ()
#1024 0x080f985f in middle::ty::unify::fixup_vars::subst_vars ()
#1025 0x0827bc13 in middle::ty::unify::fixup_vars::subst_vars::thunk3323 ()
#1026 0x080e3e7f in middle::ty::fold_ty ()
#1027 0x080df952 in middle::ty::fold_ty ()
#1028 0x080f985f in middle::ty::unify::fixup_vars::subst_vars ()
#1029 0x0827be33 in middle::ty::unify::fixup_vars::thunk3333 ()
#1030 0x080e3e7f in middle::ty::fold_ty ()
#1031 0x080f9bb7 in middle::ty::unify::fixup_vars ()
#1032 0x08137e5a in middle::typeck::demand::full ()
#1033 0x0814097a in middle::typeck::check_expr ()
#1034 0x08145d44 in middle::typeck::check_expr ()
#1035 0x0813fdca in middle::typeck::check_expr::check_then_else ()
#1036 0x08145e0f in middle::typeck::check_expr ()
#1037 0x081530aa in middle::typeck::check_block ()
#1038 0x08146df7 in middle::typeck::check_expr ()
#1039 0x081530aa in middle::typeck::check_block ()
#1040 0x08146df7 in middle::typeck::check_expr ()
#1041 0x081530aa in middle::typeck::check_block ()
#1042 0x0813f85a in middle::typeck::check_expr::check_for_or_for_each ()
#1043 0x08146170 in middle::typeck::check_expr ()
#1044 0x08152ee7 in middle::typeck::check_block ()
#1045 0x08154ee0 in middle::typeck::check_fn ()
#1046 0x08156bda in middle::typeck::check_item ()
#1047 0x0829730e in middle::typeck::check_crate::thunk5452 ()
#1048 0x080fce01 in middle::walk::walk_item ()

Activity

  1. jdm commented on Jul 3, 2011

    @jdm
    Contributor

    Helpful note from ty.rs?

    fn unify_step(&@ctxt cx, &t expected, &t actual) -> result {
        // TODO: occurs check, to make sure we don't loop forever when
        // unifying e.g. 'a and option['a]
    
  2. catamorphism commented on Jul 14, 2011

    @catamorphism
    Contributor

    I'm calling this a duplicate of #229 and the fact that stack overflow is currently a crash.

  3. added a commit that references this issue on Dec 12, 2017
  4. added a commit that references this issue on Apr 23, 2020
  5. added a commit that references this issue on Dec 24, 2022
  6. added a commit that references this issue on Jan 6, 2023
  7. added a commit that references this issue on Jan 24, 2025
  8. added a commit that references this issue on Jun 3, 2025
  9. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions