This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Another switch testcase failure with enable-checking
- From: Jan Hubicka <jh at suse dot cz>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: Jan Hubicka <jh at suse dot cz>,Graham Stott <graham dot stott at btinternet dot com>, gcc-bugs at gcc dot gnu dot org,gcc-patches at gcc dot gnu dot org
- Date: Sat, 10 Aug 2002 22:32:03 +0200
- Subject: Re: Another switch testcase failure with enable-checking
- References: <3D52BCFA.20403@btinternet.com> <20020810022010.GJ16762@atrey.karlin.mff.cuni.cz> <3D5485BC.4050907@btinternet.com> <20020810174444.GJ10671@atrey.karlin.mff.cuni.cz> <u8hei2fto4.fsf@gromit.moeb>
> Jan Hubicka <jh@suse.cz> writes:
>
> >> Jan Hubicka wrote:
> >> >>All,
> >> >>
> >> >>I've stumbled on another interesting switch testcase which triggers an
> >> >>enable-checking abort
> >> >>on all the ports I've tried so far x86, mips, sh, s390.
> >> >>
> >> >>For this testcase I get at -O2 with enable-checking enabled
> >> >>
> >> >>bug2.c: In function `foo':
> >> >>bug2.c:28: warning: verify_flow_info: Wrong probability of edge 1->19
> >> >>10008
> >> >>bug2.c:28: internal compiler error: verify_flow_info failed
> >> >>
> >> >>Jan any ideas what's wrong with the edge probability calcs
> >> >
> >> >
> >> >This is commonly just some roundoff error around. I will track it down
> >> >tomorrow.
> >> >
> >> Yes it's an around-off error somewhere I tracked down where rhe bad
> >> probability is
> >> being set. It's in cfg.c:redirect_edge_succ_nodup the stmt
> >>
> >> "s->probability += e->probability;"
> >>
> >> results in a probability > 10000 because s->probability is 9942 and
> >> e->probaility
> >> is 566 which add up to 10008.
> >>
> >> This happens on any target where the switch gets collapsed to an
> >> if-then-else.
> > Hi,
> > I am attaching patch I will install shortly.
> > Regstested/bootstrapped i386
> >
> > Honza
> >
> > Sat Aug 10 19:43:09 CEST 2002 Jan Hubicka <jh@suse.cz>
> > Graham Scott
> > * cfg.c (redirect_edge_succ_nodup): Avoid overflows due to roundoff
> > errors.
> >
> > *** cfg.c.old Sat Aug 10 20:55:22 2002
> > --- cfg.c Sat Aug 10 20:55:46 2002
> > *************** redirect_edge_succ_nodup (e, new_succ)
> > *** 455,460 ****
> > --- 455,462 ----
> > {
> > s->flags |= e->flags;
> > s->probability += e->probability;
> > + if (s->probability > REG_BR_PROB_BASE)
> > + s->probability = REG_BR_PROB_BASE;
> > s->count += e->count;
> > remove_edge (e);
> > e = s;
> >
>
> Isn't this also needed for 3.2? I propose to queue this for GCC
> 3.2.1,
I don't think so. If I remember well 3.2 does not check the frequencies
yet, so it should work fluently with bogus profile, I will check.
Honza
>
> Andreas
> --
> Andreas Jaeger
> SuSE Labs aj@suse.de
> private aj@arthur.inka.de
> http://www.suse.de/~aj