re PR tree-optimization/39799 (missing 'may be used uninitialized' warning)
authorBernd Schmidt <bernds@codesourcery.com>
Wed, 30 Jun 2010 14:16:28 +0000 (14:16 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Wed, 30 Jun 2010 14:16:28 +0000 (14:16 +0000)
PR tree-optimization/39799
* tree-inline.c (remap_ssa_name): Initialize variable only if
SSA_NAME_OCCURS_IN_ABNORMAL_PHI.

testsuite/
PR tree-optimization/39799
* c-c++-common/uninit-17.c: New test.

From-SVN: r161605

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/uninit-17.c [new file with mode: 0644]
gcc/tree-inline.c

index 4603e24b1a014938b2a4265e2a208c18f0a00791..4ee0756b6f913638758dd18d9ed38a31105fe096 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-30  Bernd Schmidt  <bernds@codesourcery.com>
+
+       PR tree-optimization/39799
+       * tree-inline.c (remap_ssa_name): Initialize variable only if
+       SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
+
 2010-06-30  Nathan Froyd  <froydnj@codesourcery.com>
 
        * c-parser.c (c_parser_omp_for_loop): Use a VEC for for_block.
index 90c5be0e824cfa76efe9822e1eeafb57a1860d27..ddc100b8169512a07081cc30c6aad9a079b3c5d4 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-30  Bernd Schmidt  <bernds@codesourcery.com>
+
+       PR tree-optimization/39799
+       * c-c++-common/uninit-17.c: New test.
+
 2010-06-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/43298
diff --git a/gcc/testsuite/c-c++-common/uninit-17.c b/gcc/testsuite/c-c++-common/uninit-17.c
new file mode 100644 (file)
index 0000000..b895ac7
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+inline int foo(int x)
+{
+  return x;
+}
+static void bar(int a, int *ptr)
+{
+  do
+  {
+    int b; /* { dg-message "note: 'b' was declared here" } */
+    if (b < 40) {
+      ptr[0] = b; /* { dg-warning "may be used uninitialized" } */
+    }
+    b += 1;
+    ptr++;
+  }
+  while (--a != 0);
+}
+void foobar(int a, int *ptr)
+{
+  bar(foo(a), ptr);
+}
+
index 3aa5f7c5baab660e98472e509a737c6879f76ad5..f1470d7a3848c3fdbb0c9f49e93da78615e7d90d 100644 (file)
@@ -234,6 +234,7 @@ remap_ssa_name (tree name, copy_body_data *id)
             regions of the CFG, but this is expensive to test.  */
          if (id->entry_bb
              && is_gimple_reg (SSA_NAME_VAR (name))
+             && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)
              && TREE_CODE (SSA_NAME_VAR (name)) != PARM_DECL
              && (id->entry_bb != EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->dest
                  || EDGE_COUNT (id->entry_bb->preds) != 1))