On Wed, May 29, 2013 at 3:35 AM, Easwaran Raman <era...@google.com> wrote: > I made a thinko when I asserted gcc_unreachable outside the main loop > of appears_later_in_bb in my previous fix to PR 57337. It is quite > possible for STMT1 to be followed by a one or more statements with the > same UID till the end of the BB without encountering STMT2. Right fix > is to return STMT1 outside the loop. Ok for trunk?
Ok. Thanks, Richard. > Thanks, > Easwaran > > 2013-05-28 Easwaran Raman <era...@google.com> > > PR tree-optimization/57442 > * tree-ssa-reassoc.c (appears_later_in_bb): Return correct value > when control exits the main loop. > > 2013-05-28 Easwaran Raman <era...@google.com> > > PR tree-optimization/57442 > * gcc.dg/tree-ssa/reassoc-30.c: New testcase. > > Index: gcc/testsuite/gcc.dg/tree-ssa/reassoc-30.c > =================================================================== > --- gcc/testsuite/gcc.dg/tree-ssa/reassoc-30.c (revision 0) > +++ gcc/testsuite/gcc.dg/tree-ssa/reassoc-30.c (revision 0) > @@ -0,0 +1,13 @@ > +/* PR tree-optimization/57442 */ > +/* { dg-do compile } */ > +/* { dg-options "-O1" } */ > +short a; > +unsigned b; > +long c; > +int d; > + > +void f(void) > +{ > + b = a ? : (a = b) - c + (d - (b + b)); > +} > + > Index: gcc/tree-ssa-reassoc.c > =================================================================== > --- gcc/tree-ssa-reassoc.c (revision 199385) > +++ gcc/tree-ssa-reassoc.c (working copy) > @@ -2888,7 +2888,7 @@ appears_later_in_bb (gimple stmt1, gimple stmt2) > else if (stmt == stmt2) > return stmt2; > } > - gcc_unreachable (); > + return stmt1; > } > > /* Find the statement after which STMT must be moved so that the