Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse exception with constant function call #9833

Open
Beuc opened this issue Nov 13, 2019 · 2 comments
Open

parse exception with constant function call #9833

Beuc opened this issue Nov 13, 2019 · 2 comments

Comments

@Beuc
Copy link
Contributor

@Beuc Beuc commented Nov 13, 2019

I doubt this construct is actually used anywhere, but this compiles fine with gcc/clang and not emcc :)
In case there's a larger bug behind:

#include <stdio.h>
void f() {}
int main(void) {
  printf("%p\n", &f); // 0x1
  int i = 0x1;
  ((void(*)(void))i)(); // ok
  ((void(*)(void))0x1)(); // compile-time crash
}
$ emcc test2.c  # 1.39.2
[parse exception: attempted pop from empty stack / beyond block start boundary at 629 (at 0:629)]
Fatal: error in parsing input
shared:ERROR: '/xxx/emsdk/upstream/bin/wasm-emscripten-finalize /tmp/emscripten_temp_Q8c4_6/a.out.wasm -o /tmp/emscripten_temp_Q8c4_6/a.out.wasm.o.wasm --detect-features --global-base=1024' failed (1)

Interestingly it compiles fine with 0x0 instead of 0x1.

@sbc100

This comment has been minimized.

Copy link
Collaborator

@sbc100 sbc100 commented Nov 13, 2019

Looks like upstream clang is generating wasm code that doesn't validate.

Could be related to https://bugs.llvm.org/show_bug.cgi?id=43133.

@sbc100

This comment has been minimized.

Copy link
Collaborator

@sbc100 sbc100 commented Nov 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
LLVM Upstream Backend
Awaiting triage
2 participants
You can’t perform that action at this time.