Skip to content

rustc crash for unreachable io loop #5741

Description

@ramonsnir

The following sample crashed rustc:

fn main() {
    return;
    while io::stdin().read_line() != ~"quit" { };
}

Removing the return;, or unwrapping the while (leaving only io::stdin().read_line() != ~"quit";), or replacing the predicate (leaving while 2 != 3 { };), solves the crash.

Reproduced on Windows 64-bit, Fedora 32-bit, Ubuntu 64-bit.

Full crash log (thanks to dbaupp) @ https://gist.github.com/dbaupp/5318920
Short crash message:

rustc: /home/huon/rust/src/llvm/include/llvm/Support/Casting.h:197:
typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&)
[with X = llvm::SequentialType; Y = llvm::Type*;
typename llvm::cast_retty<To, From>::ret_type = llvm::SequentialType*]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

Activity

  1. catamorphism commented on May 21, 2013

    @catamorphism
    Contributor

    Fixed pending #6665

  2. added a commit that references this issue on May 21, 2013
  3. catamorphism commented on May 22, 2013

    @catamorphism
    Contributor

    Fixed in 15e4438

  4. added a commit that references this issue on Jun 23, 2020
  5. added a commit that references this issue on Feb 27, 2026
  6. 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

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions