This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Another switch testcase failure with enable-checking
> 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.
I see. We need simple check for overflow here as we do on the other
places. I will bootstrap the patch and check in as default once
checkout of GCC tree finishes.
We can not avoid such thing to happen and I am keeping the check for
probability to be in the range in verify_flow_info to most importantly
catch cases where we compute absolute nonsenses (so the result is way
off the allowed range)
Thanks!
Honza
>
> >Honza
> >
>
> Graham
>
>