http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772

--- Comment #16 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-28 
13:07:41 UTC ---
(In reply to comment #15)
> 
> 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.

I understand now, and I think you are right. We don't have a warning for
"((int)x) < INT_MIN" or ((int)x) > INT_MAX but I think it should go to
Wtype-limits.

Do you think we could test this situation just before the Wlogical-op warning?
I can see that some macros may generate x >= INT_MIN but the x < INT_MIN case
seems less likely to be intented and we should warn (and then return and avoid
warning with Wlogical-op).

I am sure there must be a way to test for "x < MIN_OF_TYPE_OF(x))" and "x >
MAX_OF_TYPE_OF(x)" I just haven't investigated how.

Reply via email to