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: Tweak to gengtype


On Friday 21 January 2005 01:21, Giovanni Bajo wrote:
> Geoffrey Keating wrote:
> >> void
> >> gt_ggc_mx_use_optype_d (void *x_p)
> >> {
> >>    struct use_optype_d * const x = (struct use_optype_d *)x_p;
> >>    if (ggc_test_and_set_mark (x))
> >>      {
> >>        {
> >>          size_t i0;
> >>          for (i0 = 0; i0 < (size_t)(((*x)).num_uses); i0++) {
> >>          }
> >>        }
> >>      }
> >> }
> >>
> >> I don't know how to avoid the empty loop, and GCC doesn't know how
> >> to remove it :-/  Ideas, anyone?
> >
> > GCC should really be able to remove a trivial empty loop like this
> > one. It's easy to prove that it (a) really is empty and (b) is
> > guaranteed
> > to terminate.  (The second condition is a bit harder, but all the
> > logic should be there.)  Do you know why it's not being removed?
>
> How do you prove that x->num_uses is not 0xFFFFFFFF (or similar)?

Why does that matter? The loop will terminate for any value of x->num_uses.

Paul


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