<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58003>58003</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`strcmp()` with short string literal not folded away
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
firewave
</td>
</tr>
</table>
<pre>
```cpp
#include <cstring>
bool f(const char* c)
{
return strcmp(c, "0") == 0;
}
```
https://godbolt.org/z/soThM1sre
GCC folds away the `strcmp()` for strings up to two characters. I also tried using `__builtin_strcmp()` and `-fno-builtin` but that didn't make any difference. But to be honest I am not familiar with the builtin stuff at all.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUsuu2yAQ_Rq8GcXCEDvxwoubpK266K77iGdMSyACfKP06zt2nLa6qgU2M5w5c2Y8MurHQDr6XOp2I_RE6Bth3AXlJ22A8KPKJblwIfzTeru8ZYweLGF7FUMuoEaRCHsDRVi_wnaH5wHwSaZMKQAyqettDiLsCIQxihsjMM0JF1DCD6_o03p4qXuaYym3TDhK_IzrErWMvtQxXdD6hTvH7-O3Jifzr9YvxyPY6HUGcRcPKCPW1dE_YmbJHUVEgmepGaYblAjlHpfChCom5Rq-gvAZ3ckZDVNG5MxzPsvJ-eLC-SOjCHoGbGyImxUzu-VUUIMooJ0OhO0KXMVPg-gHeqw1yQRlajjMsAjSwBiDwR5j-iuEWMCKq_NOJLi7Mi7lrOyof7IWkFp4X1dmaLpuy3izbVmlB6573ouquOLN8J8GLGx5jKmsfQDvsHDhn0mxgVj23MFqSn748CcwdpK1ilc0vH9_fTa3FH8YVdB0OU8m46HdU8qrcZCd5cZa1u8l761m2rRdL2lj9ly3_bavvJDG54G0BxyTYO6wUMwj054qNzCKA9SzjjFOW1Zr1TRqq2hjtz3bSUG21FyF8_WsYx6RKg2LJDldMl56l0v-eylydpdgzJIO-cVUsBWDdcncxbupltzDov03QXH-6g">