Skip to content

Box[T], Mutex[T], RwLock[T] and task cores of an over-aligned T (§16.4) are 16-aligned: std's with_alloc(sizeof[T]) has no alignment #2039

Closed

Description

@ehartford

Found with #2022 (Vec buffers now aligned for their element). lib/std/box.w:13, sync.w:135/222, task.w:311 allocate with_alloc(sizeof[T]()); the runtime allocator's payloads are 16-aligned, so Box.new(Al { ... }) with @[align(32)] b can place b at 16 mod 32. Expected: the allocation carries T's TypeLayout alignment (an aligned with_alloc taking alignof[T], freed through the matching path), with a fixture that prints addr % N == 0 like behav_2022_vec_over_aligned_elements.

Activity

  1. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on fix-2036 (PR #2044, commit c80d078). with_alloc_aligned places the value, and with_free recognizes the placement. Box/Mutex/RwLock/generator cores and LLVM's Box.new pass the model alignment, and alignof reads TypeLayout for every kind. Vec keeps the size-derived alignment because its with-abi §3 header has no alignment word. Fixture: behav_2039_heap_cells_over_aligned.

  2. added a commit that references this issue on Oct 3, 2026
  3. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on main (stack #2045: #2037 + #2044; seed-driven battery GREEN on 0577d56, tree identical to main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions