[llvm-bugs] [Bug 34317] New: wasm32-unknown-unknown-wasm target generated invalid code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 24 18:12:51 PDT 2017


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: unassignedbugs at nondot.org
          Reporter: sbc at chromium.org
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170825/db3ea5f9/attachment.html>


More information about the llvm-bugs mailing list