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: unassignedb...@nondot.org
          Reporter: m...@daniel-mendler.de
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to