public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xinliang David Li <davidxl@google.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Jakub Jelinek <jakub@redhat.com>
Subject: Fix PR48484
Date: Fri, 08 Apr 2011 22:08:00 -0000	[thread overview]
Message-ID: <BANLkTik2OAo7yGQNSOyJcOHkOy7x1RpMvA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Hi, this patch fixes the test failure. OK after bootstrap and regression test?

Thanks,

David


2011-04-08  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-08  Xinliang David Li  <davidxl@google.com>

	PR tree-optimization/48484
	* g++.dg/pr48484.C: New test.

[-- Attachment #2: uninit_pred_ice.p --]
[-- Type: text/x-pascal, Size: 2845 bytes --]

Index: tree-ssa-uninit.c
===================================================================
--- tree-ssa-uninit.c	(revision 172211)
+++ tree-ssa-uninit.c	(working copy)
@@ -349,9 +349,6 @@ convert_control_dep_chain_into_preds (VE
   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 (VE
           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)
Index: testsuite/g++.dg/pr48484.C
===================================================================
--- testsuite/g++.dg/pr48484.C	(revision 0)
+++ testsuite/g++.dg/pr48484.C	(revision 0)
@@ -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);
+	}
+    }
+
+}

             reply	other threads:[~2011-04-08 22:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 22:08 Xinliang David Li [this message]
2011-04-09 15:42 ` Richard Guenther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTik2OAo7yGQNSOyJcOHkOy7x1RpMvA@mail.gmail.com \
    --to=davidxl@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).