Skip to content

When a type is #[repr(simd)], #[repr(align(N))] annotations are ignored. #130402

@fu5ha

Description

@fu5ha

See this example playground

#[repr(simd, align(32))]
struct Test([f32; 4]);

fn main() {
    println!("{}", core::mem::align_of::<Test>());
}

I expected to see this happen: an alignment of at least 32 to be printed.

Instead, this happened: the alignment is only 16, the align of the underlying platform 128bit simd vector type.

Meta

Seen on playground nightly with version

(2024-09-14 9b72238eb813e9d06e9e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-SIMDArea: SIMD (Single Instruction Multiple Data)A-alignArea: alignment control (`repr(align(N))` and so on)A-reprArea: the `#[repr(stuff)]` attributeC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions