lebedev.ri planned changes to this revision.
lebedev.ri added inline comments.


================
Comment at: test/Sema/outof-range-constant-compare.c:41
+    if (a < 0x0000000000000000UL)
+        return 0;
+    if (a <= 0x0000000000000000UL)
----------------
rjmccall wrote:
> Hmm.  I think this should probably still warn under -Wtautological-compare, 
> shouldn't it?  The fact that it also warns under -Wsign-compare is something 
> we should try to suppress, but it's definitely still a tautological 
> comparison because of the promotion to an unsigned type.
Hmm, actually, i guess so?
```
int value(void);
int main()
{
    int a = value();
    if (a <= 0x0000000000000000UL)
        return 0;       
}
```
```
      |-BinaryOperator <line:5:9, col:14> '_Bool' '<='
      | |-ImplicitCastExpr <col:9> 'unsigned long' <IntegralCast>
      | | `-ImplicitCastExpr <col:9> 'int' <LValueToRValue>
      | |   `-DeclRefExpr <col:9> 'int' lvalue Var 0x7028450 'a' 'int'
      | `-IntegerLiteral <col:14> 'unsigned long' 0
```
Here,  clang and gcc both only warn about different sign comparison.


Repository:
  rL LLVM

https://reviews.llvm.org/D37565



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to