re PR middle-end/57287 (Bogus uninitialized warning with abnormal control flow)

2013-08-29  Richard Biener  <rguenther@suse.de>

	PR middle-end/57287
	* tree-ssa-copy.c (may_propagate_copy): Allow propagating
	of default defs that appear in abnormal PHI nodes.

	* gcc.dg/pr57287-2.c: New testcase.

From-SVN: r202069
This commit is contained in:
Richard Biener 2013-08-29 11:20:16 +00:00 committed by Richard Biener
parent 6b1184bab6
commit 1b27500048
4 changed files with 53 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-08-29 Richard Biener <rguenther@suse.de>
PR middle-end/57287
* tree-ssa-copy.c (may_propagate_copy): Allow propagating
of default defs that appear in abnormal PHI nodes.
2013-08-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/57685

View File

@ -1,3 +1,8 @@
2013-08-29 Richard Biener <rguenther@suse.de>
PR middle-end/57287
* gcc.dg/pr57287-2.c: New testcase.
2013-08-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/57685

View File

@ -0,0 +1,35 @@
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
#include <setjmp.h>
struct node
{
struct node *next;
char *name;
} *list;
struct node *list;
struct node *head (void);
sigjmp_buf *bar (void);
int baz (void)
{
struct node *n;
int varseen = 0;
list = head ();
for (n = list; n; n = n->next)
{
if (!varseen)
varseen = 1;
sigjmp_buf *buf = bar (); /* { dg-bogus "may be used uninitialized" "" } */
__sigsetjmp (*buf, 1);
}
if (!varseen)
return 0;
return 1;
}

View File

@ -60,7 +60,13 @@ may_propagate_copy (tree dest, tree orig)
/* If ORIG flows in from an abnormal edge, it cannot be propagated. */
if (TREE_CODE (orig) == SSA_NAME
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig))
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (orig)
/* If it is the default definition and an automatic variable then
we can though and it is important that we do to avoid
uninitialized regular copies. */
&& !(SSA_NAME_IS_DEFAULT_DEF (orig)
&& (SSA_NAME_VAR (orig) == NULL_TREE
|| TREE_CODE (SSA_NAME_VAR (orig)) == VAR_DECL)))
return false;
/* If DEST is an SSA_NAME that flows from an abnormal edge, then it