This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR bootstrap/58340


This fixes the problem noted by Zhendong in c#4. I'll be working through other reports of issues related to the tree-ssa-threadedge.c to see if there's any lingering problems.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Installed onto the trunk.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6f3e0b8..796b8eb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-08  Jeff Law  <law@redhat.com>
+
+	* tree-ssa-threadedge.c (thread_across_edge): Fix initialization
+	of 'found'.
+
 2013-09-08  Andi Kleen  <ak@linux.intel.com>
 
 	* tree-inline.c (estimate_num_insns): Limit asm cost to 1000.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 92eaeab..756611d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-08  Jeff Law  <law@redhat.com>
+
+	* gcc.c-torture/compile/pr58340.c: New test.
+
 2013-09-08  Richard Sandiford  <rdsandiford@googlemail.com>
 
 	* g++.dg/debug/ra1.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58340.c b/gcc/testsuite/gcc.c-torture/compile/pr58340.c
new file mode 100644
index 0000000..ca3ccda
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr58340.c
@@ -0,0 +1,16 @@
+int a, b, c, d;
+
+int foo (int x, int y)
+{
+  return y == 0 ? x : 1 % y;
+}
+
+int main ()
+{
+  c = 0 || a;
+
+  for (;;)
+    b = foo (d, c) && 1;
+
+  return 0;
+}
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index afdd0af..f2051d7 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -978,7 +978,7 @@ thread_across_edge (gimple dummy_cond,
   {
     edge taken_edge;
     edge_iterator ei;
-    bool found = false;
+    bool found;
     bitmap visited = BITMAP_ALLOC (NULL);
 
     /* Look at each successor of E->dest to see if we can thread through it.  */
@@ -994,6 +994,7 @@ thread_across_edge (gimple dummy_cond,
 	   of E->dest.  */
 	path.safe_push (e);
 	path.safe_push (taken_edge);
+	found = false;
 	if ((e->flags & EDGE_DFS_BACK) == 0
 	    || ! cond_arg_set_in_bb (path[path.length () - 1], e->dest))
 	  found = thread_around_empty_blocks (taken_edge,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]