Skip to content

no_std + owned_box: thread 'rustc' has overflowed its stack Illegal instruction (core dumped) #21599

Closed
@thesam

Description

@thesam

The following code makes rustc core dump. It is hardly a normal use case, but it would be nice if rustc failed more gracefully.

$ cat main.rs
#![no_std]
#![feature(box_syntax)]
#![feature(lang_items)]

extern crate core;

use core::ptr::Unique;

#[lang="owned_box"]
pub struct Box<T>(Unique<T>);

#[lang="start"]
fn main() {
    let mut test:[isize;1] = [0;1];
    let a = box 5;
    test[*a] = 0;
}

#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop{} }
$ rustc main.rs
main.rs:5:1: 5:19 warning: use of unstable item, #[warn(unstable)] on by default
main.rs:5 extern crate core;
          ^~~~~~~~~~~~~~~~~~

thread 'rustc' has overflowed its stack
Illegal instruction (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions