From 8e3bada190db4d07b98f40a2574781872c9f7f68 Mon Sep 17 00:00:00 2001 From: mpolacek Date: Fri, 25 Jan 2013 08:52:02 +0000 Subject: [PATCH] Fix PR56035. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195462 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/cfgloopmanip.c | 6 ++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr56035.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr56035.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef53850c01c..327d2859816 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-01-25 Marek Polacek + + PR tree-optimization/56035 + * cfgloopmanip.c (fix_loop_structure): Remove redundant condition. + 2012-01-24 Uros Bizjak * config/i386/i386.md (*movti_internal_rex64): Add (o,e) alternative. diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 8c6c39de86b..c72cedaf74e 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1823,10 +1823,8 @@ fix_loop_structure (bitmap changed_bbs) /* If there was no latch, schedule the loop for removal. */ if (!first_latch) loop->header = NULL; - /* If there was a single latch and it belongs to the loop of the - header, record it. */ - else if (latch - && latch->src->loop_father == loop) + /* If there was a single latch, record it. */ + else if (latch) loop->latch = latch->src; /* Otherwise there are multiple latches which are eventually disambiguated below. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 62baf69aad9..6fc08a14745 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-01-22 Marek Polacek + + PR tree-optimization/56035 + * gcc.dg/pr56035.c: New test. + 2013-01-24 Richard Sandiford * gfortran.dg/bind_c_array_params_2.f90: Require -mno-relax-pic-calls diff --git a/gcc/testsuite/gcc.dg/pr56035.c b/gcc/testsuite/gcc.dg/pr56035.c new file mode 100644 index 00000000000..4e3a77e1997 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56035.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/56035 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize -fcse-follow-jumps -fstrict-overflow" } */ + +short a, c, *p; + +void +f (void) +{ + int b; + + if (c) + lbl1: + for (a = 0; a < 1; a++) + { + for (c = 0; c < 1; c++) + { + goto lbl1; + while (*p++) + lbl2: + ; + } + } + + for (;; b++) + { + if (c) + goto lbl2; + lbl3: + for (c = 0; c < 9; c++) + for (c = -17; c < 2; c++) + if (*p) + goto lbl3; + } +} -- 2.11.4.GIT