Skip to content

rust program that allocates a large temporary segfaults on MacOS #107814

@squell

Description

@squell

While playing around with rustc 1.69.0-nightly (bd39bbb 2023-02-07) on MacOS, I ran into the following:

//const N: usize = 2_088_032; // largest size that works without abort const N: usize = 2_092_349; // first segfault  fn main () { let _ = Box::new([0; N]); }

With N <= 2088032 this program works fine; above that the binary that rustc makes produces a runtime abort. Both are acceptable outcomes.

But with N >= 2092349 running the program results in a segmentation fault instead. It sounds like something has destroyed something that the stack unwinder relies on?

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (bd39bbb4b 2023-02-07) binary: rustc commit-hash: bd39bbb4bb92df439bf6d85470e296cc6a47ffbd commit-date: 2023-02-07 host: aarch64-apple-darwin release: 1.69.0-nightly LLVM version: 15.0.7 
Backtrace

n/a (the compiled program segfaults) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-stack-probeArea: Stack probing and guard pagesC-bugCategory: This is a bug.O-AArch64Armv8-A or later processors in AArch64 mode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions