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

            Bug ID: 34317
           Summary: wasm32-unknown-unknown-wasm target generated invalid
                    code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedb...@nondot.org
          Reporter: s...@chromium.org
                CC: llvm-bugs@lists.llvm.org

For the following C problems the wasm32-unknown-unknown-wasm generates invalid
wasm in that it includes an extra get_local which means that that type stack is
not empty when the function returns:

```
int main()
{
  int c = 1;
  asm(""::"r"(c));
  return 0;
}
```

With wasm32-unknown-unknown-wasm:

000043 <main>:
 000047: 41 01                      | i32.const 1
 000049: 21 00                      | set_local 0
 00004b: 20 00                      | get_local 0
 00004d: 41 00                      | i32.const 0
 00004f: 0b                         | end

With wasm32-unknown-unknown-elf:

000034 func[0]:
 000038: 41 01                      | i32.const 1
 00003a: 21 00                      | set_local 0
 00003c: 41 00                      | i32.const 0
 00003e: 0b                         | end

The result of running the back code in wasm-interp is:

error: type stack at end of function is 1, expected 0
000004d: error: EndFunctionBody callback failed

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to