On Fri, 21 Mar 2025, Filip Kastl wrote:

> On Thu 2025-03-20 13:31:38, Richard Biener wrote:
> > On Thu, 20 Mar 2025, Filip Kastl wrote:
> > 
> > > Hi,
> > > 
> > > Ok to push if bootstrap and regtest (on x86_64 linux) succeeds?
> > 
> > OK.
> > 
> 
> And I again almost forgot:  Can I backport this to releases/gcc-14 branch?

Yes please.

Richard.

> Filip
> 
> > > Thanks,
> > > Filip Kastl
> > > 
> > > 
> > > -- 8< --
> > > 
> > > 
> > > I increment the index variable in a loop even when I do
> > > vec::unordered_remove() which causes the vector traversal to miss some
> > > elements.  Mikael notified me of this mistake I made in my last patch.
> > > 
> > > gcc/ChangeLog:
> > > 
> > >   * gimple-ssa-sccopy.cc (scc_copy_prop::propagate): Don't
> > >   increment after vec::unordered_remove().
> > > 
> > > Reported-by: Mikael Morin <mik...@gcc.gnu.org>
> > > Signed-off-by: Filip Kastl <fka...@suse.cz>
> > > ---
> > >  gcc/gimple-ssa-sccopy.cc | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/gcc/gimple-ssa-sccopy.cc b/gcc/gimple-ssa-sccopy.cc
> > > index 298feb05571..ee2a7fa8a72 100644
> > > --- a/gcc/gimple-ssa-sccopy.cc
> > > +++ b/gcc/gimple-ssa-sccopy.cc
> > > @@ -582,9 +582,11 @@ scc_copy_prop::propagate ()
> > >    get removed.  That means parts of CFG get removed.  Those may
> > >    contain copy statements.  For that reason we prune SCCs here.  */
> > >        unsigned i;
> > > -      for (i = 0; i < scc.length (); i++)
> > > +      for (i = 0; i < scc.length ();)
> > >   if (gimple_bb (scc[i]) == NULL)
> > >     scc.unordered_remove (i);
> > > + else
> > > +   i++;
> > >        if (scc.is_empty ())
> > >   {
> > >     scc.release ();
> > > 
> > 
> > -- 
> > Richard Biener <rguent...@suse.de>
> > SUSE Software Solutions Germany GmbH,
> > Frankenstrasse 146, 90461 Nuernberg, Germany;
> > GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to