<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:chengniansun@gmail.com" title="Chengnian Sun <chengniansun@gmail.com>"> <span class="fn">Chengnian Sun</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - No -Wtautological-constant-out-of-range-compare warning"
   href="http://llvm.org/bugs/show_bug.cgi?id=18691">bug 18691</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>INVALID
           </td>
           <td>---
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - No -Wtautological-constant-out-of-range-compare warning"
   href="http://llvm.org/bugs/show_bug.cgi?id=18691#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - No -Wtautological-constant-out-of-range-compare warning"
   href="http://llvm.org/bugs/show_bug.cgi?id=18691">bug 18691</a>
              from <span class="vcard"><a class="email" href="mailto:chengniansun@gmail.com" title="Chengnian Sun <chengniansun@gmail.com>"> <span class="fn">Chengnian Sun</span></a>
</span></b>
        <pre>I found another test case. I am not sure whether I should open another report,
so just reopen this one. 


Wtautological-constant-out-of-range-compare does not warn on the following
case, which has a type conversion from bool to short type. If I remove the type
cast, Clang warns.  

/////////////////////////////////////////////////////////
// test case on which clang does not warn 
/////////////////////////////////////////////////////////
$: cat t.c
int f(int a) {
  return 999 != (short)(a == 1);
}
$: 
$: clang-trunk -Weverything -c t.c
t.c:1:5: warning: no previous prototype for function 'f' [-Wmissing-prototypes]
int f(int a) {
    ^
1 warning generated.
$: 
$: gcc-trunk -c t.c -Wall
t.c: In function ‘f’:
t.c:2:14: warning: comparison of constant ‘999’ with boolean expression is
always true [-Wbool-compare]
   return 999 != (short)(a == 1);
              ^
$: 




/////////////////////////////////////////////////////////
// clang warns on the following case 
/////////////////////////////////////////////////////////
$: cat t.c
int f(int a) {
  return 999 != (a == 1);
}
$: 
$: clang-trunk -Weverything -c t.c
t.c:1:5: warning: no previous prototype for function 'f' [-Wmissing-prototypes]
int f(int a) {
    ^
t.c:2:14: warning: comparison of constant 999 with boolean expression is always
      true [-Wtautological-constant-out-of-range-compare]
  return 999 != (a == 1);
         ~~~ ^  ~~~~~~~~
2 warnings generated.
$: 
$: gcc-trunk -c t.c -Wall
t.c: In function ‘f’:
t.c:2:14: warning: comparison of constant ‘999’ with boolean expression is
always true [-Wbool-compare]
   return 999 != (a == 1);
              ^
$:</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>