[llvm-bugs] [Bug 35385] New: WASM backend generates invalid wasm for undeclared imports
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 22 08:24:55 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35385
Bug ID: 35385
Summary: WASM backend generates invalid wasm for undeclared
imports
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: WebAssembly
Assignee: unassignedbugs at nondot.org
Reporter: ncw at realvnc.com
CC: llvm-bugs at lists.llvm.org
When the WASM backend generates a call to an incomplete function declaration,
it generates illegal WASM.
Testcase below:
#### test.c ####
// Succeeds, with (void) annotation
// Generates import with "(func)" type
extern void externSym1(void);
void exportSym1() { externSym1(); }
// Fails!
// Generates import with "(func (param i32))" type, but
// calls the imported function with the signature "void()".
extern void externSym2();
void exportSym2() { externSym2(); }
#### Commands ####
# $LLVM/clang --version
clang version 6.0.0 (trunk 318652)
Target: wasm32-unknown-unknown-wasm
Thread model: posix
# $LLVM/clang -Oz -c -o test.o test.c
# $WABT/wasm2wat test.o
0000000: error: type mismatch in call, expected [i32] but got []
The expected result (perhaps) is that the WASM backend refuses to generate
calls to functions with in incomplete declaration? But then how is linking to
varargs functions supposed to work? Hmm, I'm a bit confused really, but it
surely can't be right that the WASM output is invalid.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171122/c9b8392a/attachment.html>
More information about the llvm-bugs
mailing list