Skip to content

Dumb bugs are dumb, but still bugs: Huge types generate illegal instructions #55878

Closed
@Noxime

Description

@Noxime

Having huge data structures (larger than u64::MAX) results in incorrect binaries being built.

I tried this code:

fn main() {
    println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>());
}

I expected this to happen: Output of Size: 18446744073709551616, or a compiler error telling me the structure is too big
Instead, this happened: Binary compiled successfully, but running it results in Illegal instruction (core dumped)

Meta

rustc --version --verbose

rustc 1.32.0-nightly (6e9b84296 2018-11-10)
binary: rustc
commit-hash: 6e9b84296223126a0a59bde63a0f97011bb7b0f5
commit-date: 2018-11-10
host: x86_64-unknown-linux-gnu
release: 1.32.0-nightly
LLVM version: 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions