[PATCH] Fix PR88105

Richard Biener rguenther@suse.de
Tue Nov 20 12:18:00 GMT 2018


Boostrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

>From 27b32c8684c9703b92f5c035ebb6f06b9e2a20af Mon Sep 17 00:00:00 2001
From: Richard Guenther <rguenther@suse.de>
Date: Tue, 20 Nov 2018 10:33:16 +0100
Subject: [PATCH] fix-pr88105

2018-11-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/88074
	* tree-ssa-dom.c (pass_dominator::execute): Do not walk
	backedges.

	* gcc.dg/pr88074.c: New testcase.

diff --git a/gcc/testsuite/gcc.dg/gomp/pr88105.c b/gcc/testsuite/gcc.dg/gomp/pr88105.c
new file mode 100644
index 00000000000..9680fdd19f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr88105.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -O -fexceptions -fnon-call-exceptions -fno-tree-fre" } */
+
+int
+s0 (void)
+{
+  int g6, oh = 0;
+  int *a6 = &g6;
+
+  (void) a6;
+
+#pragma omp parallel for
+  for (g6 = 0; g6 < 1; ++g6)
+    {
+      int zk;
+
+      for (zk = 0; zk < 1; ++zk)
+        {
+          oh += zk / (zk + 1);
+
+          for (;;)
+            {
+            }
+        }
+
+      a6 = &zk;
+    }
+
+  return oh;
+}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index c50618dc809..7787da8b237 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -777,7 +777,8 @@ pass_dominator::execute (function *fun)
 	  if (bb == NULL)
 	    continue;
 	  while (single_succ_p (bb)
-		 && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
+		 && (single_succ_edge (bb)->flags
+		     & (EDGE_EH|EDGE_DFS_BACK)) == 0)
 	    bb = single_succ (bb);
 	  if (bb == EXIT_BLOCK_PTR_FOR_FN (fun))
 	    continue;



More information about the Gcc-patches mailing list