http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
--- Comment #20 from eggert at gnu dot org 2012-04-28 22:40:27 UTC --- (In reply to comment #19) > > intmax_t i = (whatever); > > if (INT_MAX < i && i <= LONG_MAX) > Have you actually seen that? No, I just now invented that example. It was based on experience I've had in using macros like those in gnulib's intprops.h <http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/intprops.h> though none of those macros actually have that particular code. >I would imagine the following to be more common: >if(i<=INT_MAX) > print("i is in 'int'"); >else if(i<=LONG_MAX) Yes, intprops.h already has written code that way (instead of using &&) in order to avoid a somewhat-similar bug in the Sun C compiler. There's a comment to that effect in intprops.h. > we are not talking of having this warning by default, > this is an isolated warning not even included in -Wall -Wextra. We can always disable -Wlogical-op when compiling any code that has the problem. It's not a big deal, though it is an annoyance that will prevent people from benefiting from -Wlogical-op. I'm afraid I don't have any magic answers here.