This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Another switch testcase failure with enable-checking


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]