From 19aa23d84ee1f001e748f8f8a6da9982dcc30a39 Mon Sep 17 00:00:00 2001 From: Yuri Rumyantsev Date: Fri, 6 May 2016 12:07:25 +0000 Subject: [PATCH] re PR debug/70935 (ICE: verify_ssa failed (error: definition in block 9 does not dominate use in block 12) w/ -O3 -g) gcc/ 2016-05-06 Yuri Rumyantsev PR debug/70935 * tree-ssa-loop-unswitch.c (find_loop_guard): Reject guard edge with loop latch destination. gcc/testsuite/ 2016-05-06 Yuri Rumyantsev PR debug/70935 * gcc.dg/torture/pr70935.c: New test. From-SVN: r235962 --- gcc/ChangeLog | 6 ++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/torture/pr70935.c | 39 ++++++++++++++++++++++++++ gcc/tree-ssa-loop-unswitch.c | 6 ++++ 4 files changed, 56 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr70935.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed6c31b2824..8f3679a52b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-06 Yuri Rumyantsev + + PR debug/70935 + * tree-ssa-loop-unswitch.c (find_loop_guard): Reject guard edge with + loop latch destination. + 2016-05-06 Martin Liska * tree-ssa-uninit.c: Apply manual changes diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc12a060fee..510e3feeeea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-06 Yuri Rumyantsev + + PR debug/70935 + * gcc.dg/torture/pr70935.c: New test. + 2016-05-06 Oleg Endo PR target/58219 diff --git a/gcc/testsuite/gcc.dg/torture/pr70935.c b/gcc/testsuite/gcc.dg/torture/pr70935.c new file mode 100644 index 00000000000..eb7f034ce83 --- /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 = ± + *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 77acd66e997..bf9fafa63b2 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -536,6 +536,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,