Skip to content

pthread_attr_t definition is incorrect, will cause unaligned memory accesses #10300

Closed
@thestinger

Description

@thestinger

It's not correct to bind a union in Rust as an array of bytes. The alignment of a byte array is always 1.

struct Foo {
    xs: [u8, ..64]
}

fn main() {
    println!("{}", std::mem::min_align_of::<Foo>())
}

x86 allows unaligned memory accesses, but other architectures are not as forgiving.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions