This makes sure we cleanup at least some of the spurious copies that can be introduced for example by jump-threading and that confuse uninitialized var analysis.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2013-08-29 Richard Biener <rguent...@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. Index: gcc/tree-ssa-copy.c =================================================================== *** gcc/tree-ssa-copy.c (revision 202068) --- gcc/tree-ssa-copy.c (working copy) *************** may_propagate_copy (tree dest, tree orig *** 60,66 **** /* 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)) return false; /* If DEST is an SSA_NAME that flows from an abnormal edge, then it --- 60,72 ---- /* 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) ! /* 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 Index: gcc/testsuite/gcc.dg/pr57287-2.c =================================================================== *** gcc/testsuite/gcc.dg/pr57287-2.c (revision 0) --- gcc/testsuite/gcc.dg/pr57287-2.c (working copy) *************** *** 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; + }