diff options
author | Ian Lance Taylor <iant@google.com> | 2007-04-24 20:44:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2007-04-24 20:44:45 +0000 |
commit | 4df28528f69a4400fed72d69792fc043d1ebd826 (patch) | |
tree | 99bf754860728790f12fd6d1c13768b33b045464 /gcc/tree-ssa-loop-ch.c | |
parent | 7c4a92651592752bb73c2f672f3fa358b6839c1f (diff) | |
download | gcc-4df28528f69a4400fed72d69792fc043d1ebd826.zip gcc-4df28528f69a4400fed72d69792fc043d1ebd826.tar.gz gcc-4df28528f69a4400fed72d69792fc043d1ebd826.tar.bz2 |
re PR tree-optimization/31602 (Overflow warning causes GDB -Werror build failure)
./: 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.
From-SVN: r124120
Diffstat (limited to 'gcc/tree-ssa-loop-ch.c')
-rw-r--r-- | gcc/tree-ssa-loop-ch.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index 3033c90..e2e272b2 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -1,5 +1,5 @@ /* Loop header copying on trees. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -200,6 +200,27 @@ copy_loop_headers (void) continue; } + /* If the loop has the form "for (i = j; i < j + 10; i++)" then + this copying can introduce a case where we rely on undefined + signed overflow to eliminate the preheader condition, because + we assume that "j < j + 10" is true. We don't want to warn + about that case for -Wstrict-overflow, because in general we + don't warn about overflow involving loops. Prevent the + warning by setting TREE_NO_WARNING. */ + if (warn_strict_overflow > 0) + { + unsigned int i; + + for (i = 0; i < n_bbs; ++i) + { + tree last; + + last = last_stmt (copied_bbs[i]); + if (TREE_CODE (last) == COND_EXPR) + TREE_NO_WARNING (last) = 1; + } + } + /* Ensure that the latch and the preheader is simple (we know that they are not now, since there was the loop exit condition. */ split_edge (loop_preheader_edge (loop)); |