Skip to content

LLVM ERROR: Too many bits for int64_t #112770

@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(repr128)]
#[derive(PartialEq, Debug)]
#[repr(i128)]
enum Test {
    A(Box<u64>) = 0,
    B(usize) = u64::MAX as i128 + 1,
}

fn main() {
    assert_ne!(Test::A(Box::new(2)), Test::B(0));
    // This previously caused a segfault.
    //
    // See https://github.com/rust-lang/rust/issues/70509#issuecomment-620654186
    // for a detailed explanation.
}

Meta

rustc --version --verbose:

0c2c243342ec2a2427f0624fac5ac59f0ee6fbcd

Error output

warning: the feature `repr128` is incomplete and may not be safe to use and/or cause compiler crashes
 --> 100612.rs:1:12
  |
1 | #![feature(repr128)]
  |            ^^^^^^^
  |
  = note: see issue #56071 <https://github.com/rust-lang/rust/issues/56071> for more information
  = note: `#[warn(incomplete_features)]` on by default
Backtrace

rustc: /home/matthias/vcs/github/rust_debug_assertions/src/llvm-project/llvm/include/llvm/ADT/APInt.h:1519: int64_t llvm::APInt::getSExtValue() const: Assertion `getSignificantBits() <= 64 && "Too many bits for int64_t"' failed.
[2]    32637 IOT instruction  RUST_BACKTRACE=full ~/.rustup/toolchains/local-debug-assertions/bin/rustc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions