re PR go/57045 (Build failure in libgo/runtime/proc.c: error: ‘({anonymous})’ may...
authorJakub Jelinek <jakub@redhat.com>
Fri, 26 Apr 2013 13:14:55 +0000 (15:14 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 26 Apr 2013 13:14:55 +0000 (15:14 +0200)
PR go/57045
* tree-ssa-uninit.c (compute_uninit_opnds_pos): In functions
with nonlocal goto receivers or returns twice calls, ignore
unininitialized values from abnormal edges to nl goto receiver
or returns twice call.

* gcc.dg/setjmp-5.c: New test.

From-SVN: r198340

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/setjmp-5.c [new file with mode: 0644]
gcc/tree-ssa-uninit.c

index bd5c8f1ef0b4c521c00e9187e0d670a81449a7a0..47d1bccbe6b3de80d1539acf304528c705c611d4 100644 (file)
@@ -1,3 +1,11 @@
+2013-04-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR go/57045
+       * tree-ssa-uninit.c (compute_uninit_opnds_pos): In functions
+       with nonlocal goto receivers or returns twice calls, ignore
+       unininitialized values from abnormal edges to nl goto receiver
+       or returns twice call.
+
 2013-04-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/57051
index 1081ef992519b58d0ca8b8cdb167544b9e7aaf1b..bbea9faf93644851240d85b481b1ea57d55a3ee6 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR go/57045
+       * gcc.dg/setjmp-5.c: New test.
+
 2013-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/55708
diff --git a/gcc/testsuite/gcc.dg/setjmp-5.c b/gcc/testsuite/gcc.dg/setjmp-5.c
new file mode 100644 (file)
index 0000000..c6e5f93
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+#include <setjmp.h>
+
+void bar (int);
+
+jmp_buf buf;
+int v;
+
+void
+foo (void)
+{
+  int i;
+  bar (0);
+  bar (1);
+  i = 5;
+  int j = setjmp (buf);
+  if (j == 0)
+    bar (2);
+  v = i;       /* { dg-bogus "may be used uninitialized in this function" } */
+}
index e8f3ff7e7302fef5652d89e58f1618be672e8293..2cb22b7035eba6fb6500436282b0931bdd0cd6d1 100644 (file)
@@ -151,7 +151,21 @@ compute_uninit_opnds_pos (gimple phi)
       if (TREE_CODE (op) == SSA_NAME
           && ssa_undefined_value_p (op)
           && !can_skip_redundant_opnd (op, phi))
-        MASK_SET_BIT (uninit_opnds, i);
+       {
+         /* Ignore SSA_NAMEs on abnormal edges to setjmp
+            or nonlocal goto receiver.  */
+          if (cfun->has_nonlocal_label || cfun->calls_setjmp)
+           {
+             edge e = gimple_phi_arg_edge (phi, i);
+             if (e->flags & EDGE_ABNORMAL)
+               {
+                 gimple last = last_stmt (e->src);
+                 if (last && stmt_can_make_abnormal_goto (last))
+                   continue;
+               }
+           }
+         MASK_SET_BIT (uninit_opnds, i);
+       }
     }
   return uninit_opnds;
 }