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

    <tr>
        <th>Summary</th>
        <td>
            Clang doesn't warn about always false comparisons
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Clang doesn't warn about always false comparisons. 
GCC reports the warning for the same program

Sample program:
```
#include <stddef.h>
#define getstr(s) ((const char *)((s) + 1))

int test(const char* s)
{
 if (s== NULL || getstr(s) == NULL)
 {
 return 1;
 }
 return 0;
}
```
Compilation with clang:
```
# clang -c -Wall program.c
#
```

Compilation with GCC:
```
# gcc -c -Wall program.c
program.c: In function test:
program.c:6:28: warning: the comparison will always evaluate as _false_ for the pointer operand in _s + 1_ must not be NULL [-Waddress]
 6 |  if (s== NULL || getstr(s) == NULL)
      |
```

Compiler versions:
```
clang version 16.0.6 
gcc (GCC) 13.2.1
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE1r4zAQ_TXyZYixpfjr4EPibMpC2cuy9BhkeWJrkSUjyQ3994s_krSl7cJuCLakefNmmPcs7pxsNWJJkj1JDgEffWds2Y-uQ21egto0L2WluG6hMeg0oZmHC7caeG1GD1xd-IuDM1cOQZh-4FY6o10IJDqQaPdQVWBxMNY78B3OqVK3cDZ23jveIwzWtJb3S8by_Mn7Qd0jbD0mabT-ly1lUgs1NgiEVc43DZ7DjrBvt3CDZ6kRWvTOW0JzR2gBhOaE5sJo50F03AKhO0KL5XhF7CGej4rXXUntwaPzb7IJ3YG7A7P9sgB5hpmOHQg7wI9fj49Asopk1ftu7oAbC9xpLPrRaogJ299ih7ex6Ba7hd4NqjL9IBX30mi4SN-BmCT9YqwLADYCNk9cqasQobghPs78uNpDVX1VqxXi00r3LdvBdw3nUYuZeNbhSvoalRK2o_kEX802LSev3e0JF6nU1bv4zNXIPQJ3cJqNfLrZczBSe7RgBrRcNyA1nNzijhP0o_OgjYcaV3mT_eaJN41F50hyFSmdZIf_s8P8m-B_GzpaeEbrpNHus4kvyq4oiNMwCtP1a52EIDSf5KIFxCykYfxFyaApWVOwggdYxllUJAkrGAu6MhY0TzKKcRY3KY-KLIoyFp_TbZHlWGRxIEsa0W3Eom1Mo4SxMM3qhNcxbmsRo-CcbCPsuVShUs99aGwbSOdGLHOWsyRQvEbl5juL0sXKlE7Xly0n_KYeW0e2kZLOuzuDl17hv1xmwWhV2Xk_zDOlR0KPrfTdWIfC9IQepwrrazNY8xuFJ_Q4N-wIPc49_wkAAP__WT6PNg">