<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56035>56035</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            -Winfinite-recursion confused by some tautological expressions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            clang:diagnostics
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          AaronBallman
      </td>
    </tr>
</table>

<pre>
    Consider code like:
```
void func1(int i) {
  if (i || !i)
    func1(i);
}

void func2(int i) {
  if (i > 0 || i <= 0)
    func2(i);
}
```
Clang correctly diagnoses `func2()` as being recursive along all paths, but it mysteriously does not diagnose `func1()`. (https://godbolt.org/z/Ks3Wvdf8W)

Surprisingly, we don't seem to catch `i || !i` as being a tautological comparison, so it's possible that's a related issue (https://godbolt.org/z/hs9Ehrbss).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNUktz2yAQ_jXoshMPQpZkHXRI7OTSYw85g0ASLQYNi9y6v76LYyd1O512Bj2WXb7HLiroc78PHq02EYagDTj71bDqkfED44-s4dd1CU_BahhXP5RM7KxPYJnogLVPb2kAO0LO0NaeFv2XueKWhY-zebe6HmPt4fpzTyL-RVI9A79R5XDPqgPwPwjF3wnv7e2d9BN1IUYzJHcGbeXkAxoEKrkhZaCGg0RQxlI51a4R7cmAdIFi6RwsMs3IxB7USvITHM-YTLRhxYwaCNCH9A5_Qy_f0TfZ4JzSgnkS4oXWFLQKLm1CnCj6Qc8nrF5Pety9vht-e39e4xItkjZ3zhq-GaL0TLQJ0JgjpACDTMOcae8n9astCUmuKbgw2UE6aspxkYSagfaAgVwRIsISEK1yBtIs33YkdcTJZDRYxNX8j5MZu-c5KqSWdZtC95Xuqk4WySZn-odX60frbTIP11YHT3L8uCJxqDOJOZp7seb7Eg3mQizW6Prf-G2aV7UhRxQ4d7p9HpYYvtDgKbwoJzUvdcOruph72dSdlmU78moo20Zta6W7odE73ZRcGFE4qYzDntVPTIgh3yPiG2PwyXhNW7lrv2Suo092wJysD4XtBReCN-W2bLf1drsRraqqRnFd7lqp1Y5tuTlK6zZZa25eEfuLbLVOSElnMeFHUpL_yRtzkUT41J85xP5RkqYnuqNH6YuLzf7i8SfW4Tom">