Skip to content

align_offset infinite loop #103361

Description

@lukas-code

I tried this code: (Playground)

fn main() {
    struct HugeSize([u8; (1 << 47) - 1]);
    let _ = ((1usize << 47) as *const HugeSize).align_offset(1 << 47);
}

I expected to see this happen: The program terminates.

Instead, this happened: The program loops indefinitely.

I encountered this while working on #102795

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (dcb376115 2022-10-20)
binary: rustc
commit-hash: dcb376115066d111dbf5f13d5ac2a2dbe8c12add
commit-date: 2022-10-20
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Activity

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

    C-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions