This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66773] sign-compare warning for == and != are pretty useless
- From: "daniel.marjamaki at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 06 Jul 2015 18:23:22 +0000
- Subject: [Bug c/66773] sign-compare warning for == and != are pretty useless
- Auto-submitted: auto-generated
- References: <bug-66773-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66773
--- Comment #2 from Daniel MarjamÃki <daniel.marjamaki at gmail dot com> ---
Thanks!
Hmm.. in my humble opinion, when I see the code:
int f(void) { return 0xffffffff == -1; }
.. I get the impression that the developer probably wants to test if the
bitpattern 0xfff.. matches -1.
I'd say an arbitrary U32 variable will rarelly have such large values unless
it's representing bitpatterns.. indexes, positions, sizes, etc are not that
large. and if you match a bitpattern against a negative value I'd say the match
is probably expected.
Is it possible to test how much noise this generates? My feeling is that if I
run this on various open source projects I will get lots of pure noise. If I am
right, do you think such noise would be convincing?