Skip to content

Invalid bitcast with repr(simd), array type, and wasm #80108

Closed
@calebzulawski

Description

@calebzulawski

For some reason this only occurs with wasm. If you compile this on the playground, it works just fine until you compile for wasm, which produces this error.

Code

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=685f1384988924fc87ac7760fccab58a

#![feature(repr_simd)]

#[repr(simd)]
pub struct Vector([i32; 4]);

impl Vector {
    pub const fn to_array(self) -> [i32; 4] {
        self.0
    }
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (b32e6e6ac 2020-12-16)
binary: rustc
commit-hash: b32e6e6ac8921035177256ab6806e6ab0d4b9b94
commit-date: 2020-12-16
host: x86_64-apple-darwin
release: 1.50.0-nightly

Error output

Invalid bitcast
  %4 = bitcast <4 x i32> %1 to [4 x i32], !dbg !21
in function _ZN10playground6Vector8to_array17h22d416c39ac2333dE
LLVM ERROR: Broken function found, compilation aborted!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-SIMDArea: SIMD (Single Instruction Multiple Data)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-wasmTarget: WASM (WebAssembly), http://webassembly.org/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