public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH PR70935, Regression 6,7]
@ 2016-05-05 15:19 Yuri Rumyantsev
  2016-05-06 10:45 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Yuri Rumyantsev @ 2016-05-05 15:19 UTC (permalink / raw)
  To: gcc-patches, Richard Biener, Igor Zamyatin,
	Илья
	Энкович

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

Hi All,

Here is a simple patch which cures the problem with nonlegal
transformation of endless loop. THe fix is simply check that guard
edge destination is not loop latch block.

Bootstrapping and regression testing did not show any new failures.
Is it OK for trunk?

ChangeLog:
2016-05-05  Yuri Rumyantsev  <ysrumyan@gmail.com>

PR debug/70935
* tree-ssa-loop-unswitch.c (find_loop_guard): Reject guard edge with
loop latch destination.

gcc/testsuite/ChangeLog
* gcc.dg/torture/pr70935.c: New test.

[-- Attachment #2: patch.1 --]
[-- Type: application/octet-stream, Size: 1448 bytes --]

diff --git a/gcc/testsuite/gcc.dg/torture/pr70935.c b/gcc/testsuite/gcc.dg/torture/pr70935.c
new file mode 100755
index 0000000..9ef5a5a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70935.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -g" } */
+
+int d0, sj, v0, rp, zi;
+
+void
+zn(void)
+{
+  if (v0 != 0)
+    {
+      int *js, *r3;
+      int pm, gc;
+
+      for (gc = 0; gc < 1; ++gc)
+        {
+          sj = 1;
+          while (sj != 0)
+            ;
+        }
+      r3 = &pm;
+      *js = (long)&gc;
+ka:
+      for (d0 = 0; d0 < 2; ++d0)
+        {
+          d0 = zi;
+          if (zi)
+            for (pm = 2; pm != 0; --pm)
+              ;
+        }
+      while (*r3 != 0)
+        {
+          while (pm)
+            ;
+          ++r3;
+        }
+    }
+  rp = 0;
+  goto ka;
+}

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index dd6fd01..ba1f13c 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -532,6 +532,12 @@ find_loop_guard (struct loop *loop)
 		 guard_edge->src->index, guard_edge->dest->index);
       return NULL;
     }
+  if (guard_edge->dest == loop->latch)
+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+	fprintf (dump_file, "Guard edge destination is loop latch.\n");
+      return NULL;
+    }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH PR70935, Regression 6,7]
  2016-05-05 15:19 [PATCH PR70935, Regression 6,7] Yuri Rumyantsev
@ 2016-05-06 10:45 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-05-06 10:45 UTC (permalink / raw)
  To: Yuri Rumyantsev
  Cc: gcc-patches, Igor Zamyatin,
	Илья
	Энкович

On Thu, May 5, 2016 at 5:19 PM, Yuri Rumyantsev <ysrumyan@gmail.com> wrote:
> Hi All,
>
> Here is a simple patch which cures the problem with nonlegal
> transformation of endless loop. THe fix is simply check that guard
> edge destination is not loop latch block.
>
> Bootstrapping and regression testing did not show any new failures.
> Is it OK for trunk?

Ok for trunk and branch.

THanks,
RIchard.

> ChangeLog:
> 2016-05-05  Yuri Rumyantsev  <ysrumyan@gmail.com>
>
> PR debug/70935
> * tree-ssa-loop-unswitch.c (find_loop_guard): Reject guard edge with
> loop latch destination.
>
> gcc/testsuite/ChangeLog
> * gcc.dg/torture/pr70935.c: New test.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-06 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 15:19 [PATCH PR70935, Regression 6,7] Yuri Rumyantsev
2016-05-06 10:45 ` Richard Biener

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).