[Bug c/43772] Errant -Wlogical-op warning when testing limits
marc.glisse at normalesup dot org
gcc-bugzilla@gcc.gnu.org
Sat Apr 28 12:56:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
--- Comment #15 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-28 12:55:28 UTC ---
(In reply to comment #14)
> (In reply to comment #13)
> >
> > Except that this version would warn for x<INT_MIN && x>INT_MAX, whereas this
> > belongs to other warnings. So testing the triviality of the first ranges seems
> > best.
>
> I don't understand. This warning (whatever its name) should precisely warn for
> that with "logical 'and' of mutually exclusive tests is always false".
No, there could be a warning that the first test is always false, another one
that the second one is always false, but adding a third warning that the
conjunction of the 2 is always false seems bogus. This warning is meant for:
x<5&&x>10, where each test independently could be true, just not both at the
same time.
At least that is my understanding...
More information about the Gcc-bugs
mailing list