Commit edfcd7e3 by Richard Biener Committed by Richard Biener

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
parent 6659fe59
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.
2017-03-08 Andrew Haley <aph@redhat.com> 2017-03-08 Andrew Haley <aph@redhat.com>
PR tree-optimization/79943 PR tree-optimization/79943
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
2017-03-08 Richard Biener <rguenther@suse.de> 2017-03-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/79955
* gcc.dg/uninit-24.c: New testcase.
2017-03-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/79920 PR tree-optimization/79920
* gcc.dg/vect/pr79920.c: New testcase. * gcc.dg/vect/pr79920.c: New testcase.
......
/* { dg-do compile } */
/* { dg-options "-O -Wmaybe-uninitialized" } */
int foo (int x)
{
int y;
if (x)
return *(&y + 1); /* { dg-bogus "may be used uninitialized" } */
return 0;
}
...@@ -287,6 +287,17 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized) ...@@ -287,6 +287,17 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
|| TREE_NO_WARNING (base)) || TREE_NO_WARNING (base))
continue; 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 /* Limit the walking to a constant number of stmts after
we overcommit quadratic behavior for small functions we overcommit quadratic behavior for small functions
and O(n) behavior. */ and O(n) behavior. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment