<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62173>62173</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang++ miscompiles the code if return statement is missing: comparison and a conditional jump are not emitted to ASM
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
srogatch
</td>
</tr>
</table>
<pre>
Please, see the reproducer here: https://github.com/srogatch/no_comparison/tree/clang
The same bug is present in g++ - see the `master` branch.
```
clang++ --version
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
```
clang++ miscompiles the given source file, so that the comparison and conditional jump instructions are not emitted in the assembly (see the assembly file I generate). Probably adding `return 0;` or compiling in Debug fixes the problem.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU99rvDgQ_2viy6AkcXV3H3zYvSLcw0Hh7r1EM6spMZFM0tv-90dc2x79Qr8giDOTyeeXishMDrFjzZU1T4VKcfaho-AnFce5GLx-754tKkIm_wBChDgjBFyD12nEADMGZPUF5hhXYvWFyZ7JfjJxTkM1-oXJ_mMbk73zL6NfVhUMecdkHwMik_1olZsYf2L88s-MQGpBGNIEhmANSOgiGAcTk1cmr1B-4mAtXxRFDKzlMATlxrl6rGEt35_t83HBfrx8w0DGu_-1YC-B4BWveHlIQ3IxCdhBqTBhzDTvp_alPZTrWFrj0r2cXPrAHVBpWLxGmwdXT-b-WyyLoayHsUgbocm8oQPyKYwIN2MfqnuIs4rbwJd6oJyG0TttovFOWXhNywrGUQxpzCUCFRCcj4CLiRF11jDvUES4DPYdmDx9KPlZy5fCnzChw6AiMnmu4Dn4QeWm0tq4KcseMKbggLP6mrX3AR48cts4eMJs383cd15r8IPFZTen0F2tz_VZFdiJ9iSOkjenppi7m8RTi7WQUumjHPRNCHE-ad6IBsVZ8MJ0ksuaH8SRn-pWNtWt5aI5NvzWNvJ8HgQ7cFyUsZW1b0vlw1QYooRdK8WxLqwa0NIWdikd_gtbk0mZsx-6fKYc0kTswK2hSF9bookWu5-sG71GMDfYlaGoIi5bcinPknFTzsU3A9WvFn53LXq4_P1XkYLtfvjJMtL9Va7Bv-IYmew3fsRkv_H_LwAA__8l9kg_">