Skip to content

{.align.} pragma is not applied if there is a generic field #13122

@mratsim

Description

@mratsim

The align pragma is not applied if one of the field is generic, test case:

import atomics type Bug[T] = object bug{.align:64.}: T sideffect{.align:64.}: int type Foo[T] = object foo{.align:64.}: int sideffect{.align:64.}: int type Bar = object bar{.align:64.}: int sideffect{.align:64.}: int type Baz = object baz{.align:64.}: Atomic[int] sideffect{.align:64.}: int var bug: Bug[int] var x: Foo[int] var y: Bar var z: Baz doAssert sizeof(x) == 128 doAssert sizeof(y) == 128 doAssert sizeof(z) == 128 doAssert sizeof(bug) == 128, "Oops my size is " & $sizeof(bug) # 16

It is missing in the C codegen.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions