Skip to content

LLVM_ERROR: invalid bitcast: transmute #110005

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

fn main() {
    let x: Option<Box<[u8]>> = unsafe {
        let z = (0usize, true);
        std::mem::transmute::<(usize, bool), Option<Box<[u8]>>>(z)
    };
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (2eaeb1eee 2023-04-05)
binary: rustc
commit-hash: 2eaeb1eee1b21772de8b935236d16ff8e03fdcf5
commit-date: 2023-04-05
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.0

Error output

<output>
Backtrace

warning: unused variable: `x`
 --> treereduce.out:2:9
  |
2 |     let x: Option<Box<[u8]>> = unsafe {
  |         ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

Invalid bitcast
  %7 = bitcast i8 %6 to i64
in function _ZN10treereduce4main17haa15f44c7ccefff9E
LLVM ERROR: Broken function found, compilation aborted!

Metadata

Metadata

Assignees

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) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions