<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - False Positive of -Wtautological-overlap-compare on Expressions in Return Statement" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24238&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=3JZAjBVEvfo494j-8k49Vi_UzqkJzh1LRmt8fRhmmDM&s=ZvxEVU2bvkay8JcKS7tGZ9a3TqXLnYI3Z9eU1AoBcDg&e=">24238</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False Positive of -Wtautological-overlap-compare on Expressions in Return Statement
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang does not warn on the expression "x > 6 && x < 2" in the return statement.
If this expression is in the if conditional, it warns. 

$: cat s.c
int g(int x) {
  return x > 6 && x < 2;
}
int f(int x) {
  if (x > 6 && x < 2) {
    return 1;
  }
  return 0;
}
$: 
$: clang-trunk -Wtautological-overlap-compare -c s.c
s.c:5:13: warning: overlapping comparisons always evaluate to false
[-Wtautological-overlap-compare]
  if (x > 6 && x < 2) {
      ~~~~~~^~~~~~~~
1 warning generated.
$: 
$: gcc-trunk -c -Wlogical-op s.c
s.c: In function ‘g’:
s.c:2:16: warning: logical ‘and’ of mutually exclusive tests is always false
[-Wlogical-op]
   return x > 6 && x < 2;
                ^
s.c: In function ‘f’:
s.c:5:13: warning: logical ‘and’ of mutually exclusive tests is always false
[-Wlogical-op]
   if (x > 6 && x < 2) {
             ^
$:</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>