Skip to content

Validation of internal globals in const expressions is inconsistent between interpreter and spec #1522

Closed
@binji

Description

@binji

The following WebAssembly module is invalid in the reference interpreter:

(memory 1)
(global i32 (i32.const 0)
(data (global.get 0) "")

This was originally disallowed in #383. However, the test added in that PR was commented out.

However, the spec currently explicitly mentions that global initializers can only reference imported globals, but does not mention anything about the same for data and element segments. Module validation also seems to use C instead of C' when validating data/element segments too, indicating that they can access both internal and imported globals.

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