Skip to content

LLVM error when cloning Vec of certain struct in release mode #103380

Closed
@mat-1

Description

@mat-1

I found this issue when I was compiling one of my large projects, and was able to track it down to the code below. Unfortunately, I haven't been able to reproduce the issue on any other machines other than this one (which is running Ubuntu 20.02.4 on Oracle Cloud, if that matters). The error only seems to happen in release mode in nightly.

Code

#[derive(Clone)]
pub struct Foo(Bar, u32);

#[derive(Clone, Copy)]
pub struct Bar(u8, u8, u8);

fn main() {
    let foo: Vec<Foo> = Vec::new();
    let _ = foo.clone();
}

Meta

rustc --version --verbose:

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

Error output

Invalid bitcast
  %63 = bitcast <4 x i32> %62 to <4 x i24>
Invalid bitcast
  %65 = bitcast <4 x i32> %64 to <4 x i24>
in function _ZN67_$LT$alloc..vec..Vec$LT$T$C$A$GT$$u20$as$u20$core..clone..Clone$GT$5clone17h90016bd0a1a635e4E
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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions