summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-uninit.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-03-08 14:10:47 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-03-08 14:10:47 +0000
commitedfcd7e3d471b9dde2d9a84490a850d2f850f381 (patch)
tree8052c1b41778ff9f1e2e9505b8521a982efc2e63 /gcc/tree-ssa-uninit.c
parent6659fe59f3c39e991149fe60f17d0628d771a454 (diff)
re PR tree-optimization/79955 (GLIBC build fails after r245840)
2017-03-08 Richard Biener <rguenther@suse.de> PR tree-optimization/79955 * tree-ssa-uninit.c (warn_uninitialized_vars): Do not warn for accesses that are completely outside of the variable. * gcc.dg/uninit-24.c: New testcase. From-SVN: r245976
Diffstat (limited to 'gcc/tree-ssa-uninit.c')
-rw-r--r--gcc/tree-ssa-uninit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 1805c674ea4..e019ecc9d29 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -287,6 +287,17 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
|| TREE_NO_WARNING (base))
continue;
+ /* Do not warn if the access is fully outside of the
+ variable. */
+ if (ref.size != -1
+ && ref.max_size == ref.size
+ && (ref.offset + ref.size <= 0
+ || (ref.offset >= 0
+ && TREE_CODE (DECL_SIZE (base)) == INTEGER_CST
+ && compare_tree_int (DECL_SIZE (base),
+ ref.offset) <= 0)))
+ continue;
+
/* Limit the walking to a constant number of stmts after
we overcommit quadratic behavior for small functions
and O(n) behavior. */