Skip to content

wasm64: i32.store8[0] expected type i64 #26865

@jijjijj

Description

@jijjijj

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 5.0.7 (263db4cffa6f9fc2ec514a70abac81362ea41849)
clang version 23.0.0git (https:/github.com/llvm/llvm-project 7b58716d96c3ae4c0c4e6f72e29b16137bb6224b)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/_/.conan2/p/b/emsdk0a8073caa1b86/p/bin/upstream/bin

Full link command and output with -v appended:

/home/_/.conan2/p/b/emsdk0a8073caa1b86/p/bin/upstream/emscripten/em++ -stdlib=libc++ -ffunction-sections -gdwarf -sMEMORY64=1 -g -gdwarf -O0 -flto=thin -sALLOW_MEMORY_GROWTH=1 -sMEMORY64=1 -sNO_DISABLE_EXCEPTION_CATCHING -Xlinker --gc-sections -msimd128 src/core/client/exec/CMakeFiles/core.client.exec.dir/main.cpp.o -o src/core/client/exec/client.js -L/home/_/.conan2/p/b/highwa76ccc51f0794/p/lib   -L/home/_/.conan2/p/b/spdlo1200e34525b02/p/lib -Wl,--whole-archive  src/core/client/libwrapper/libwrapper.a  -Wl,--no-whole-archive  3rdparty/highway/highway.modules.a  /home/_/.conan2/p/b/highwa76ccc51f0794/p/lib/libhwy_contrib.a  /home/_/.conan2/p/b/highwa76ccc51f0794/p/lib/libhwy.a  -Wl,--whole-archive  src/core/client/libclient/libclient.a  -Wl,--no-whole-archive  3rdparty/stduuid/stduuid.modules.a  -Wl,--whole-archive  src/shared/util/libutil/libutil.a  -Wl,--no-whole-archive   3rdparty/spdlog/spdlog.modules.a  /home/_/.conan2/p/b/spdlo1200e34525b02/p/lib/libspdlogd.a  -Wl,--whole-archive  src/shared/common/libcommon/libcommon.a  -Wl,--no-whole-archive  3rdparty/std/std.modules.a  3rdparty/ms-gsl/ms-gsl.modules.a  -lidbfs.js

Output when running node client.js:

failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #216:"eng::sample_client@_.client()" failed: i32.store8[0] expected type i64, found local.tee of type i32 @+54254
Aborted(CompileError: WebAssembly.instantiate(): Compiling function #216:"eng::sample_client@_.client()" failed: i32.store8[0] expected type i64, found local.tee of type i32 @+54254)
/build/ems-debug-wasm-cov/src/core/client/exec/client.js:577
  var e = new WebAssembly.RuntimeError(what);
          ^

RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): Compiling function #216:"eng::sample_client@_.client()" failed: i32.store8[0] expected type i64, found local.tee of type i32 @+54254)
    at abort (/build/ems-debug-wasm-cov/src/core/client/exec/client.js:577:11)
    at instantiateArrayBuffer (/build/ems-debug-wasm-cov/src/core/client/exec/client.js:642:5)
    at async createWasm (/build/ems-debug-wasm-cov/src/core/client/exec/client.js:740:16)

Node.js v25.9.0

The code that triggers this behaviour, if you remove && val_b everything's fine.

module _;

import std;
import :client;

namespace eng {
int sample_client() {
    const bool val_a = false;
    const bool val_b = false;
    if (val_a && val_b) {
        return 3;
    }
    return 6;
}

int enter(int /*argc*/, char** /*argv*/) {
    std::cout << sample_client() << std::endl;

    return 6;
}
}

What could be the reason for this?

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