public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65423] New: No warning on always-true/false predicates containing bitwise operations
@ 2015-03-14 9:45 chengniansun at gmail dot com
2015-03-14 18:11 ` [Bug c/65423] " mpolacek at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: chengniansun at gmail dot com @ 2015-03-14 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65423
Bug ID: 65423
Summary: No warning on always-true/false predicates containing
bitwise operations
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
The condition "(a & 9) == 4" is always false, and it will be great if Gcc can
emit a warning on this.
$: cat bitwise.c
int f(int a) {
if ((a & 9) == 4) {
return 1;
} else {
return 0;
}
}
$: clang-trunk -Wtautological-compare -c bitwise.c
bitwise.c:2:15: warning: bitwise comparison always evaluates to false
[-Wtautological-compare]
if ((a & 9) == 4) {
~~~~~~~~^~~~
1 warning generated.
$: gcc-trunk -Wall -Wextra -Wtype-limits -c bitwise.c
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/65423] No warning on always-true/false predicates containing bitwise operations
2015-03-14 9:45 [Bug c/65423] New: No warning on always-true/false predicates containing bitwise operations chengniansun at gmail dot com
@ 2015-03-14 18:11 ` mpolacek at gcc dot gnu.org
2015-03-15 9:17 ` maltsevm at gmail dot com
2015-03-16 15:47 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-14 18:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65423
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yes, that would be nice. I think we already have such a bug report, though.
I'll look for it later.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/65423] No warning on always-true/false predicates containing bitwise operations
2015-03-14 9:45 [Bug c/65423] New: No warning on always-true/false predicates containing bitwise operations chengniansun at gmail dot com
2015-03-14 18:11 ` [Bug c/65423] " mpolacek at gcc dot gnu.org
@ 2015-03-15 9:17 ` maltsevm at gmail dot com
2015-03-16 15:47 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: maltsevm at gmail dot com @ 2015-03-15 9:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65423
Mikhail Maltsev <maltsevm at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maltsevm at gmail dot com
--- Comment #2 from Mikhail Maltsev <maltsevm at gmail dot com> ---
Probably this one: PR17534
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/65423] No warning on always-true/false predicates containing bitwise operations
2015-03-14 9:45 [Bug c/65423] New: No warning on always-true/false predicates containing bitwise operations chengniansun at gmail dot com
2015-03-14 18:11 ` [Bug c/65423] " mpolacek at gcc dot gnu.org
2015-03-15 9:17 ` maltsevm at gmail dot com
@ 2015-03-16 15:47 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-16 15:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65423
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 17534 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-16 15:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-14 9:45 [Bug c/65423] New: No warning on always-true/false predicates containing bitwise operations chengniansun at gmail dot com
2015-03-14 18:11 ` [Bug c/65423] " mpolacek at gcc dot gnu.org
2015-03-15 9:17 ` maltsevm at gmail dot com
2015-03-16 15:47 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).