[Bug c/53131] -Wlogical-op: ready for prime time in -Wall ?
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Apr 28 12:18:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53131
--- Comment #5 from dcb <dcb314 at hotmail dot com> 2012-04-28 12:17:57 UTC ---
(In reply to comment #4)
> Could you give a sample? -Wlogical-op merges 2 unrelated warnings:
> *) x && 2 (you would expect a boolean, not 2, so maybe x&2 was meant)
> *) x<0 && x>0 (not so likely to happen) or x>=-5 || x<2 (always true)
>
> and it is not clear which one you are most interested in.
#2 is the one I am interested in.
I only discovered the other warning by accident, after 8
of the 10 warnings I checked closely.
I used the Linux kernel as an example. I'd probably need to analyse
more cases, in other packages too, to be sure that most of what
the warning finds is #2.
It seems a pretty small warning, but I guess #1 and #2 could
be split up, if that helps get #2 in.
More information about the Gcc-bugs
mailing list