public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/29694] New: missed warnings about comparisons which are always true/false.
@ 2006-11-03 10:32 pluto at agmk dot net
2006-11-03 10:39 ` [Bug other/29694] " pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2006-11-03 10:32 UTC (permalink / raw)
To: gcc-bugs
unsigned foo( unsigned i )
{
if ( i < 0 )
i++;
if ( i >= 0 )
i++;
return i;
}
g++ 412svn/420svn with `-O2 -Wall' reports no errors.
--
Summary: missed warnings about comparisons which are always
true/false.
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
GCC target triplet: ix86-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
@ 2006-11-03 10:39 ` pinskia at gcc dot gnu dot org
2006-11-03 10:44 ` pluto at agmk dot net
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-03 10:39 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-11-03 10:39 -------
Adding -W/-Wextra and we get a warning:
t.c: In function foo:
t.c:3: warning: comparison of unsigned expression < 0 is always false
t.c:5: warning: comparison of unsigned expression >= 0 is always true
I always forget what -Wextra is for.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
2006-11-03 10:39 ` [Bug other/29694] " pinskia at gcc dot gnu dot org
@ 2006-11-03 10:44 ` pluto at agmk dot net
2007-01-09 15:22 ` manu at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2006-11-03 10:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pluto at agmk dot net 2006-11-03 10:44 -------
(In reply to comment #1)
> Adding -W/-Wextra and we get a warning:
> t.c: In function �foo�:
> t.c:3: warning: comparison of unsigned expression < 0 is always false
> t.c:5: warning: comparison of unsigned expression >= 0 is always true
>
>
> I always forget what -Wextra is for.
what about -Walways-true ?
<man>
-Walways-true
Warn about comparisons which are always true such as testing if
unsigned values are greater than or equal to zero. This warning
is enabled by -Wall.
</man>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
2006-11-03 10:39 ` [Bug other/29694] " pinskia at gcc dot gnu dot org
2006-11-03 10:44 ` pluto at agmk dot net
@ 2007-01-09 15:22 ` manu at gcc dot gnu dot org
2007-01-09 18:41 ` gdr at integrable-solutions dot net
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-09 15:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from manu at gcc dot gnu dot org 2007-01-09 15:21 -------
Wextra warns for this, what is the bug?
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
` (2 preceding siblings ...)
2007-01-09 15:22 ` manu at gcc dot gnu dot org
@ 2007-01-09 18:41 ` gdr at integrable-solutions dot net
2007-01-09 20:29 ` manu at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: gdr at integrable-solutions dot net @ 2007-01-09 18:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from gdr at integrable-solutions dot net 2007-01-09 18:41 -------
Subject: Re: missed warnings about comparisons which are always true/false.
"manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| Wextra warns for this, what is the bug?
I believe pluto wants -Walways-true to cover this.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
` (3 preceding siblings ...)
2007-01-09 18:41 ` gdr at integrable-solutions dot net
@ 2007-01-09 20:29 ` manu at gcc dot gnu dot org
2007-01-20 16:30 ` manu at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-09 20:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from manu at gcc dot gnu dot org 2007-01-09 20:28 -------
(In reply to comment #4)
> Subject: Re: missed warnings about comparisons which are always true/false.
>
> "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
>
> | Wextra warns for this, what is the bug?
>
> I believe pluto wants -Walways-true to cover this.
>
I pity the poor guy that implements that. Linus will surely kill him/her.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
` (4 preceding siblings ...)
2007-01-09 20:29 ` manu at gcc dot gnu dot org
@ 2007-01-20 16:30 ` manu at gcc dot gnu dot org
2007-01-23 20:15 ` pluto at agmk dot net
2007-05-20 20:33 ` manu at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-20 16:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from manu at gcc dot gnu dot org 2007-01-20 16:30 -------
This is a duplicate of PR 23587.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
` (5 preceding siblings ...)
2007-01-20 16:30 ` manu at gcc dot gnu dot org
@ 2007-01-23 20:15 ` pluto at agmk dot net
2007-05-20 20:33 ` manu at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pluto at agmk dot net @ 2007-01-23 20:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pluto at agmk dot net 2007-01-23 20:15 -------
(In reply to comment #4)
> Subject: Re: missed warnings about comparisons which are always true/false.
>
> "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
>
> | Wextra warns for this, what is the bug?
>
> I believe pluto wants -Walways-true to cover this.
>
> -- Gaby
exactly.
*** This bug has been marked as a duplicate of 23587 ***
--
pluto at agmk dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug other/29694] missed warnings about comparisons which are always true/false.
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
` (6 preceding siblings ...)
2007-01-23 20:15 ` pluto at agmk dot net
@ 2007-05-20 20:33 ` manu at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-05-20 20:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from manu at gcc dot gnu dot org 2007-05-20 21:31 -------
Subject: Bug 29694
Author: manu
Date: Sun May 20 20:29:55 2007
New Revision: 124875
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124875
Log:
2007-05-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR middle-end/7651
PR c++/11856
PR c/12963
PR c/23587
PR other/29694
* c.opt (Wtype-limits): New.
* doc/invoke.texi (Wtype-limits): Document it.
(Wextra): Enabled by -Wextra.
* c-opts.c (c_common_post_options): Enabled by -Wextra.
* c-common.c (shorten_compare): Warn with Wtype-limits.
testsuite/
* gcc.dg/compare6.c: Replace Wall with Wtype-limits.
* gcc.dg/Wtype-limits.c: New.
* gcc.dg/Wtype-limits-Wextra.c: New.
* gcc.dg/Wtype-limits-no.c: New.
* g++.dg/warn/Wtype-limits.C: New.
* g++.dg/warn/Wtype-limits-Wextra.C: New.
* g++.dg/warn/Wtype-limits-no.C: New.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
trunk/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
trunk/gcc/testsuite/g++.dg/warn/Wtype-limits.C
trunk/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c
trunk/gcc/testsuite/gcc.dg/Wtype-limits-no.c
trunk/gcc/testsuite/gcc.dg/Wtype-limits.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-common.c
trunk/gcc/c-opts.c
trunk/gcc/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/compare6.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29694
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-05-20 20:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-03 10:32 [Bug other/29694] New: missed warnings about comparisons which are always true/false pluto at agmk dot net
2006-11-03 10:39 ` [Bug other/29694] " pinskia at gcc dot gnu dot org
2006-11-03 10:44 ` pluto at agmk dot net
2007-01-09 15:22 ` manu at gcc dot gnu dot org
2007-01-09 18:41 ` gdr at integrable-solutions dot net
2007-01-09 20:29 ` manu at gcc dot gnu dot org
2007-01-20 16:30 ` manu at gcc dot gnu dot org
2007-01-23 20:15 ` pluto at agmk dot net
2007-05-20 20:33 ` manu at gcc dot gnu dot 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).