Skip to content

std lib fmt test generate too many locals on wasm32 in Debug mode #15609

Open
@dweiller

Description

@dweiller

Zig Version

0.11.0-dev commit d71a43e

Steps to Reproduce and Observed Behavior

Comment out the second test called "enum" in lib/std/fmt.zig and then run the stdlib tests under wasmtime: zig test lib/std/std.zig -target wasm32-wasi --test-cmd wasmtime --test-cmd --dir=. --test-cmd-bin --test-cmd --.

This fails with:

Error: if you're trying to run a precompiled module, pass --allow-precompiled

Caused by:
    0: failed to compile wasm function 958 (`fmt.formatType__anon_44251`) at offset 0x117a56
    1: WebAssembly translation error
    2: Invalid input WebAssembly code at offset 1145431: too many locals: locals exceed maximum

Due to the line in the first test called "enum" containing this line:

try expectFmt("enum: os.windows.win32error.Win32Error.INVALID_FUNCTION\n", "enum: {}\n", std.os.windows.Win32Error.INVALID_FUNCTION});

In release modes the test passes. This is presumably something about lack of optimisations producing many locals due to the size of the os.windows.Win32Error enum.

Note that due to #13599 and #14583 the first test named "enum" hasn't been running for some time, so I'm not sure when this regressed (or if it even did).

Expected Behavior

The test should pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions