Patchwork PR bootstrap/58340

login
register
mail settings
Submitter Jeff Law
Date Sept. 9, 2013, 3:09 a.m.
Message ID <522D3BD1.1050606@redhat.com>
Download mbox | patch
Permalink /patch/273477/
State New
Headers show

Comments

Jeff Law - Sept. 9, 2013, 3:09 a.m.
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.
Gerald Pfeifer - Sept. 9, 2013, 9:26 a.m.
On Sun, 8 Sep 2013, Jeff Law wrote:
> 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.

It also fixes my original report, PR bootstrap/58340 (on 
x86_64-unknown-freebsd).

Thanks,
Gerald
Jeff Law - Sept. 9, 2013, 1:20 p.m.
On 09/09/2013 03:26 AM, Gerald Pfeifer wrote:
> On Sun, 8 Sep 2013, Jeff Law wrote:
>> 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.
>
> It also fixes my original report, PR bootstrap/58340 (on
> x86_64-unknown-freebsd).
Thanks for the confirmation.  The patch likely fixed the ia64 
mis-compare, but it'll be hours before I know that for sure.

I'm going to assume the the darwin and other x86_64 linux failures are 
fixed as well.  While they never failed for me, I can easily speculate 
how that bug would result incorrect codegen leading to a stage3 failure 
of that nature.

jeff

Patch

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,