public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure
@ 2007-04-17 12:21 drow at gcc dot gnu dot org
2007-04-17 12:26 ` [Bug tree-optimization/31602] " drow at false dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: drow at gcc dot gnu dot org @ 2007-04-17 12:21 UTC (permalink / raw)
To: gcc-bugs
GCC HEAD now warns about this testcase for mips-linux, reduced from
gdb/value.c. Compile with -O2 -Wall:
extern int foo();
int show_values (void)
{
int i;
static int num;
if (num <= 0)
num = 1;
for (i = num; i < num + 10; i++)
foo();
return i;
}
overflow.c:10: warning: assuming signed overflow does not occur when assuming
that (X + c) >= X is always true
I think that the problem arises when we assume that the loop is executed at
least once; the initial condition is num < num + 10. However the warning does
not arise if num is an argument to the function instead of a static variable.
Unfortunately the warning appears to be correct. I say unfortunately because
there's no apparent way to avoid the warning - which sounds more like -Wextra
to -Wall. Does this this example contradict the "easy to avoid" statement in
the -Wstrict-overflow=1 documentation?
--
Summary: Overflow warning causes GDB -Werror build failure
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: drow at gcc dot gnu dot org
GCC target triplet: mips-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
@ 2007-04-17 12:26 ` drow at false dot org
2007-04-18 14:14 ` ian at airs dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: drow at false dot org @ 2007-04-17 12:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from drow at gcc dot gnu dot org 2007-04-17 13:26 -------
Subject: Re: New: Overflow warning causes
GDB -Werror build failure
On Tue, Apr 17, 2007 at 12:21:36PM -0000, drow at gcc dot gnu dot org wrote:
> GCC HEAD now warns about this testcase for mips-linux, reduced from
> gdb/value.c.
The warning also occurs once in top.c:
for (offset = num; offset < num + Hist_print && offset < hist_len; offset++)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
2007-04-17 12:26 ` [Bug tree-optimization/31602] " drow at false dot org
@ 2007-04-18 14:14 ` ian at airs dot com
2007-04-20 15:17 ` ian at airs dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2007-04-18 14:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from ian at airs dot com 2007-04-18 15:14 -------
Yes, the warning is happening because gcc relies on undefined signed overflow
when assuming that it will execute the loop at least once. Of course when
using -fwrapv the loop should not be executed at all when num > INT_MAX - 10.
I'll try to figure out what to do about this.
--
ian at airs dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|ian at gcc dot gnu dot org |ian at airs dot com
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-04-18 15:14:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
2007-04-17 12:26 ` [Bug tree-optimization/31602] " drow at false dot org
2007-04-18 14:14 ` ian at airs dot com
@ 2007-04-20 15:17 ` ian at airs dot com
2007-04-20 19:04 ` drow at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2007-04-20 15:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from ian at airs dot com 2007-04-20 16:17 -------
Created an attachment (id=13394)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13394&action=view)
Proposed patch
This patch fixes the test case in the PR. I am testing it. It would be
interesting to hear whether it also fixes the actual code in gdb.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-04-20 15:17 ` ian at airs dot com
@ 2007-04-20 19:04 ` drow at gcc dot gnu dot org
2007-04-24 20:45 ` ian at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: drow at gcc dot gnu dot org @ 2007-04-20 19:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from drow at gcc dot gnu dot org 2007-04-20 20:04 -------
Subject: Re: Overflow warning causes GDB
-Werror build failure
On Fri, Apr 20, 2007 at 03:17:19PM -0000, ian at airs dot com wrote:
> This patch fixes the test case in the PR. I am testing it. It would be
> interesting to hear whether it also fixes the actual code in gdb.
With this patch I can successfully build GDB for mips-linux - thanks!
(barring PR31605).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-04-20 19:04 ` drow at gcc dot gnu dot org
@ 2007-04-24 20:45 ` ian at gcc dot gnu dot org
2007-04-24 21:54 ` ian at gcc dot gnu dot org
2007-04-24 22:27 ` ian at airs dot com
6 siblings, 0 replies; 8+ messages in thread
From: ian at gcc dot gnu dot org @ 2007-04-24 20:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from ian at gcc dot gnu dot org 2007-04-24 21:44 -------
Subject: Bug 31602
Author: ian
Date: Tue Apr 24 21:44:45 2007
New Revision: 124120
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124120
Log:
./:
PR tree-optimization/31602
* tree-ssa-loop-ch.c (copy_loop_headers): Set TREE_NO_WARNING for
conditionals in the copied loop header.
* tree-cfg.c (fold_cond_expr_cond): Don't issue undefined overflow
warnings if TREE_NO_WARNING is set.
* doc/invoke.texi (Warning Options): Clarify that
-Wstrict-overflow does not warn about loops.
testsuite/:
PR tree-optimization/31602
* gcc.dg/Wstrict-overflow-11.c: We no longer issue a warning.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
trunk/gcc/tree-cfg.c
trunk/gcc/tree-ssa-loop-ch.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-04-24 20:45 ` ian at gcc dot gnu dot org
@ 2007-04-24 21:54 ` ian at gcc dot gnu dot org
2007-04-24 22:27 ` ian at airs dot com
6 siblings, 0 replies; 8+ messages in thread
From: ian at gcc dot gnu dot org @ 2007-04-24 21:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from ian at gcc dot gnu dot org 2007-04-24 22:54 -------
Subject: Bug 31602
Author: ian
Date: Tue Apr 24 22:54:22 2007
New Revision: 124127
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124127
Log:
PR tree-optimization/31602
* tree-ssa-loop-ch.c (copy_loop_headers): Set TREE_NO_WARNING for
conditionals in the copied loop header.
* tree-cfg.c (fold_cond_expr_cond): Don't issue undefined overflow
warnings if TREE_NO_WARNING is set.
* doc/invoke.texi (Warning Options): Clarify that
-Wstrict-overflow does not warn about loops.
Modified:
branches/gcc-4_2-branch/gcc/ChangeLog
branches/gcc-4_2-branch/gcc/doc/invoke.texi
branches/gcc-4_2-branch/gcc/tree-cfg.c
branches/gcc-4_2-branch/gcc/tree-ssa-loop-ch.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/31602] Overflow warning causes GDB -Werror build failure
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-04-24 21:54 ` ian at gcc dot gnu dot org
@ 2007-04-24 22:27 ` ian at airs dot com
6 siblings, 0 replies; 8+ messages in thread
From: ian at airs dot com @ 2007-04-24 22:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from ian at airs dot com 2007-04-24 23:27 -------
Fixed on mainline and 4.2 branch.
--
ian at airs dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31602
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-04-24 22:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-17 12:21 [Bug tree-optimization/31602] New: Overflow warning causes GDB -Werror build failure drow at gcc dot gnu dot org
2007-04-17 12:26 ` [Bug tree-optimization/31602] " drow at false dot org
2007-04-18 14:14 ` ian at airs dot com
2007-04-20 15:17 ` ian at airs dot com
2007-04-20 19:04 ` drow at gcc dot gnu dot org
2007-04-24 20:45 ` ian at gcc dot gnu dot org
2007-04-24 21:54 ` ian at gcc dot gnu dot org
2007-04-24 22:27 ` ian at airs dot com
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).