This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Tweak to gengtype
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)?
--
Giovanni Bajo