<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56935>56935</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang generates incorrect wasm object code from .s input
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TerrorJack
</td>
</tr>
</table>
<pre>
Minimal repro:
```asm
foo:
.functype foo () -> (i32)
i32.const 420
if i32
i32.const 421
return
else
i32.const 423
end_if
end_function
```
Compile it with `clang --target=wasm32-wasi -c test.s -o test.o`, then disassemble with `wasm-objdump -d test.o`:
```
test.o: file format wasm 0x1
Code Disassembly:
000041 func[0] <foo>:
000042: 41 a4 03 | i32.const 420
000045: 04 7f | if i32
000047: 41 a5 03 | i32.const 421
00004a: 0f | return
00004b: 41 a7 03 | i32.const 423
00004e: 0b | end
00004f: 0b | end
```
`else` has been incorrectly dropped.
This is confirmed against both 14.0.6 and trunk.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVE2PnDAM_TVwsUCB8LEcOLQz20Ol3vZeBWKYdIGgJHQ7_74OLDu0na1aFIGd-PnZyQuNltf6i5rUKAYwOBsd8A8BOwdsfxdsG8KO20ynbzFxt0ytu84INAtB-hCkFUQBf_S24im5WyDZcasn6yBL2etUBz5itQGOAck-adAtZto8HCzeC-avy5P8qrqbvRam9PRbF8fWTnqc1YCgHLwodwFabgcx9RBFTpgeXcDPL9Q2TyP6KIhacGhdbCHSm6V9xvQE7oITSGWFtTg2lHLP5-GRbr7JZZwhkgfUO7u8ua9hPqbqfImdNqOgMikdsB_Jr11IhPMb9_W3zIyeLAG_HUH-kQX5GQJ-Ws_w8S0U1qiUfKBYkQHj8OcTlCe4c44bOPdglkHZ3UHu4OOJr6hyp8zfp7yvjRUuVtJ3GN_gRxVtuGanLf-Vlh_huNI2f6UlDR4h3f9A7qqV3PUKFAwuwkKDJDk1tdoYbN1wBWn0PKOMj5ini7JAg7rolBlRguiF8h01mgSaZDGLCxATCdMs03McYp0UeVVkvGBFKGsuK16J0Ck3YL3djR4nNIIEeiPfZEkq93br5dgZPULsQ-bFhYsZ6otzs_V6Sz_R6Ol6LA1t7kjOMHzfPxH9f3wWcpW1C1oy8qLieXipseJdzhOWZ9hK8VBmBcqkTJoKpSxFVYaDaGiDalJ5kKYTvsCagmzSfKjqlKUpeyCVM0b9xVmZSCzztuqwlP58MoajUEPs64i16UNTryU1S29pcVDW2dsi3TbVT4grHeUXi7toUz-hMdp8Fu1zuLLXa_U_AeWJd5k">