-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.10 (b7dc6e5747465580df5984e723b9d1f10d8e804b)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 8f7e57485ee73205e108d74abb5565d5c63beaca)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\devel\emsdk\upstream\bin
Compile the code below as follows:
em++ main.cpp -sEXIT_RUNTIME=1 -o main.html
#include <iostream>
#include <string>
const std::string& f()
{
static const std::string& x = {};
return x;
}
int main()
{
std::cout << f() << '\n';
}
Running in browser results in the following error in console:
Uncaught RuntimeError: null function or function signature mismatch
at main.wasm:0xf65
at exitRuntime (main.js:1:3158)
at exitJS (main.js:1:57013)
at callMain (main.js:1:58576)
at doRun (main.js:1:58955)
at main.js:1:59092
Seems like for other targets this code compiles and runs fine, so it shouldn't actually be UB
Metadata
Metadata
Assignees
Labels
No labels