mgrabovsky added a comment.

In http://reviews.llvm.org/D13643#272046, @danielmarjamaki wrote:

> In http://reviews.llvm.org/D13643#271885, @danielmarjamaki wrote:
>
> > I tested this on 2199 debian projects.. and got 16 warnings.
> >
> >   ftp://ftp.se.debian.org/debian/pool/main/t/tf5/tf5_5.0beta8.orig.tar.gz
> >   expr.c:738:22: warning: comparisons such as 'a < b != c' do not have 
> > their mathematical meaning [-Wparentheses]
> >           if (neg0 == neg1 && sum<0 != neg0) {
> >                               ^~~~~~~~~~~~~
> >   
> >
> > I guess it could be intentional. I haven't looked in the real code.
> >  ....
>
>
> Do you have any comments on that one.


In the code you posted, `neg0` should be Boolean (technically, it's an `int`, 
but it should be either 0 or 1, which clang can detect using 
`Expr::isKnownToHaveBooleanValue`). Although, aaron.ballman suggested above 
that such code is unclear and should use parentheses. Thus this warning is de 
facto intentional.


http://reviews.llvm.org/D13643



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

Reply via email to