Skip to content

Addresses are unintentionally aligned #791

@pvdrz

Description

@pvdrz

During the implementation of the intptrcast model we discovered that memory addresses are aligned even when miri::intptrcast::GlobalState::align_addr is not used.

Relevant code:

let x = (&5u8 as *const u8 as usize) * 2;
let y = (&6u16 as *const u16 as usize) * 2 / 2;
assert!(y % 2 == 1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intptrcastArea: affects int2ptr and ptr2int castsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions