Fix PR48484
authorXinliang David Li <davidxl@google.com>
Sat, 9 Apr 2011 16:29:08 +0000 (16:29 +0000)
committerXinliang David Li <davidxl@gcc.gnu.org>
Sat, 9 Apr 2011 16:29:08 +0000 (16:29 +0000)
From-SVN: r172229

gcc/ChangeLog
gcc/testsuite/g++.dg/pr48484.C [new file with mode: 0644]
gcc/tree-ssa-uninit.c

index c9976bd9f6f7acefd873a4dd3bc8374b1ce3af0f..ea76776a23eac3d2976d85fa53713d281da2a45d 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-09  Xinliang David Li  <davidxl@google.com>
+
+       PR tree-optimization/PR48484
+       * tree-ssa-uninit.c (convert_control_dep_chain_into_preds): Set
+       has_valid_pred lazily
+
 2011-04-09  Duncan Sands  <baldrick@free.fr>
 
        * tree.c (array_type_nelts): Bail out if TYPE_MAX_VALUE not set.
diff --git a/gcc/testsuite/g++.dg/pr48484.C b/gcc/testsuite/g++.dg/pr48484.C
new file mode 100644 (file)
index 0000000..3f17f39
--- /dev/null
@@ -0,0 +1,105 @@
+/* { dg-do compile } */
+/* { dg-options "-O -finline-functions -finline-small-functions -Wuninitialized" }  */
+
+
+struct SQObjectPtr
+{
+  int _type;
+  SQObjectPtr operator = (long);
+};
+struct SQObjectPtrVec
+{
+  SQObjectPtr fff (unsigned);
+  SQObjectPtr *_vals;
+};
+
+struct SQInstruction
+{
+  int _arg1;
+  unsigned op;
+  unsigned _arg0;
+  unsigned _arg2;
+};
+struct SQVM
+{
+  struct CallInfo
+  {
+    SQInstruction *_ip;
+  };
+    bool
+    Execute (SQObjectPtr &, long, long, long, SQObjectPtr &, unsigned, int);
+    bool
+    FOREACH_OP
+    (SQObjectPtr
+     &, SQObjectPtr &, SQObjectPtr &, SQObjectPtr &, long, int, int &);
+  SQObjectPtrVec _stack;
+  CallInfo *ci;
+  long _nnativecalls;
+  bool ShouldSuspend ();
+};
+struct AutoDec
+{
+  AutoDec (long *);
+   ~AutoDec ();
+};
+bool
+  SQVM::FOREACH_OP
+  (SQObjectPtr
+   &
+   o1,
+   SQObjectPtr & o2, SQObjectPtr &, SQObjectPtr & o4, long, int, int &jump)
+{
+  long
+    nrefidx = 0;
+  switch (o1._type)
+    {
+    case 0x02000000:
+      o4 = nrefidx;
+      jump = 1;
+      return true;
+    case 0x00000080:
+      {
+       long
+         idx = 10;
+       o2 = idx;
+       jump = 0;
+      }
+    }
+}
+
+bool
+  SQVM::Execute
+  (SQObjectPtr &, long, long, long, SQObjectPtr &, unsigned, int)
+{
+  AutoDec
+  ad (&_nnativecalls);
+  for (;;)
+    {
+      if (ShouldSuspend ())
+       return true;
+      SQInstruction
+       _i_ = *ci->_ip;
+      switch (_i_.op)
+       {
+       case 0:
+         {
+           int
+             tojump;
+
+           FOREACH_OP
+             (_stack._vals
+              [_i_._arg0],
+              _stack._vals
+              [_i_._arg2],
+              _stack._vals
+              [_i_._arg2],
+              _stack._vals[_i_._arg2], _i_._arg2, _i_._arg1, tojump);
+
+           ci += tojump;  /* { dg-warning "uninitialized" "warning" }  */
+         }
+       case 1:
+         _stack.fff (_i_._arg1);
+       }
+    }
+
+}
index 02b166ab883902f3aa33627a4cf3ac4e25632179..479ffce5ed79833a9fafcc3fb3d7bfd35db8e71c 100644 (file)
@@ -349,9 +349,6 @@ convert_control_dep_chain_into_preds (VEC(edge, heap) **dep_chains,
   if (num_chains == 0 || num_chains >= MAX_NUM_CHAINS)
     return false;
 
-  /* Now convert CD chains into predicates  */
-  has_valid_pred = true;
-
   /* Now convert the control dep chain into a set
      of predicates.  */
   *preds = XCNEWVEC (VEC(use_pred_info_t, heap) *,
@@ -412,6 +409,7 @@ convert_control_dep_chain_into_preds (VEC(edge, heap) **dep_chains,
           one_pred->cond = cond_stmt;
           one_pred->invert = !!(e->flags & EDGE_FALSE_VALUE);
           VEC_safe_push (use_pred_info_t, heap, (*preds)[i], one_pred);
+         has_valid_pred = true;
         }
 
       if (!has_valid_pred)