[llvm-bugs] [Bug 45007] New: wasm32: return_call_indirect type mismatch

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 24 06:45:08 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45007

            Bug ID: 45007
           Summary: wasm32: return_call_indirect type mismatch
           Product: new-bugs
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mail at daniel-mendler.de
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

$ clang-9 -O3 -ffreestanding -nostdinc -nostdlib --target=wasm32 -mtail-call
test.c -o test.wasm

Running the file test.wasm using `node --experimental-wasm-return_call`
produces a type mismatch error. Looking into the produced wasm code using
wabt-objdump there is indeed a mismatch `return_call_indirect 0 0` refers to
the type `() -> nil` instead of `() -> i32` as it should be.

---
// test.c
typedef int (*Fn)(void);

int g(void) {
    return 0;
}

Fn p = g;

int f(void) {
    return p();
}

void _start() {
    f();
}
---

A variation of the program using attribute(noinline) also does not work:

---
// test.c
typedef int (*Fn)(void);

int g(void) {
    return 0;
}

Fn p = g;

__attribute__((noinline)) int f(void) {
    return p();
}

void _start() {
    f();
}
---

-- 
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/20200224/10702ff8/attachment.html>


More information about the llvm-bugs mailing list