Skip to content

Crash when returning inside while-loop #1974

Closed
@veddan

Description

@veddan

When I try to run the following program it crashes with an error message from glibc.

fn main() {
  let s = "hej";
  while s != "" {
    ret;
  }
}

The error message is

*** glibc detected *** ./crash: double free or corruption (fasttop): 0x0000000001a2c7d0 ***

I tried running the program with valgrind. It then produced a different error message:

rust: fatal, 'live_allocs < 1' failed, ./src/rt/memory_region.cpp:54 

If I change the loop to "while true", the program finishes without error.

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationI-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