Skip to content

memarg align bugs in the text format (missing 2^n note) #2193

Description

@bvisness

The definition of memarg in the text format has regressed in the Wasm 3.0 spec, specifically with regard to alignment. The rule definition uses the variable m but claims to produce an alignment of n (out of thin air), and there is nothing to translate from the raw alignment number (e.g. "4" or "8") to a power of two (e.g. 2 or 3). Both of these were correct in the Wasm 2.0 spec.

Additionally, the order of align= and offset= have been reversed. A literal reading of the spec would imply that in 2.0, offset must come before alignment, while in 3.0, alignment must come before offset. It is not clear to me if this strictness is intended, but it is a likely unintended difference between the spec versions.

3.0 (current):

Image

2.0:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions