From 0dcbc6dd8e6bc57a27d5b1cdbd8447a2f5a618b2 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 12 Feb 2019 09:29:39 +0000 Subject: [PATCH] re PR tree-optimization/89253 (ICE in split_loop, at tree-ssa-loop-split.c:566) 2019-02-12 Richard Biener PR tree-optimization/89253 * tree-ssa-loop-split.c (tree_ssa_split_loops): Check we can duplicate the loop. * gfortran.dg/pr89253.f: New testcase. From-SVN: r268790 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr89253.f | 19 +++++++++++++++++++ gcc/tree-ssa-loop-split.c | 3 ++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr89253.f diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33623ad..fd015eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-02-12 Richard Biener + + PR tree-optimization/89253 + * tree-ssa-loop-split.c (tree_ssa_split_loops): Check we can + duplicate the loop. + 2019-02-11 David Malcolm PR lto/88147 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae04c4b..de2f092 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-12 Richard Biener + + PR tree-optimization/89253 + * gfortran.dg/pr89253.f: New testcase. + 2019-02-11 Marek Polacek PR c++/89212 - ICE converting nullptr to pointer-to-member-function. diff --git a/gcc/testsuite/gfortran.dg/pr89253.f b/gcc/testsuite/gfortran.dg/pr89253.f new file mode 100644 index 0000000..6dc9df1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr89253.f @@ -0,0 +1,19 @@ +! { dg-do compile } +! { dg-additional-options "-fsplit-loops -fno-tree-dominator-opts -std=legacy -w" } + program jr + integer :: w5, pg, zh + w5 = 0 + write (w5) + assign 0002 to w5 + do pg = 1, 3 + if (pg .eq. 1) then + do zh = 1, pg + end do + else + goto w5 + 0001 zh = 0 + 0002 zh = 0 + assign 0001 to w5 + endif + end do + end diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index 9b9d01a..999c9a3 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -649,7 +649,8 @@ tree_ssa_split_loops (void) false, true) && niter.cmp != ERROR_MARK /* We can't yet handle loops controlled by a != predicate. */ - && niter.cmp != NE_EXPR) + && niter.cmp != NE_EXPR + && can_duplicate_loop_p (loop)) { if (split_loop (loop, &niter)) { -- 2.7.4