]> gcc.gnu.org Git - gcc.git/commitdiff
re PR middle-end/57287 (Bogus uninitialized warning with abnormal control flow)
authorRichard Biener <rguenther@suse.de>
Thu, 29 Aug 2013 11:20:16 +0000 (11:20 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 29 Aug 2013 11:20:16 +0000 (11:20 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr57287-2.c [new file with mode: 0644]
gcc/tree-ssa-copy.c

index 2444b92cda73b807cebaaa7705d9e16ab7bf10e7..ad77502e277db07f175a95d1d1af287be47131ef 100644 (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
index 9b9ff4240caa65725456ea942ac5fb337637b0d5..d95d535a92c730babcccd3440390093b7142e859 100644 (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
diff --git a/gcc/testsuite/gcc.dg/pr57287-2.c b/gcc/testsuite/gcc.dg/pr57287-2.c
new file mode 100644 (file)
index 0000000..5422e14
--- /dev/null
@@ -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;
+}
index 75ab54aeda6e426577b8923b83ccfc69738d3577..9bc455c61a728760d9b17d4b90a41a3b81752393 100644 (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
This page took 0.096541 seconds and 5 git commands to generate.