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: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism


Hi Tobias,

>> +  for (ref = e->ref; ref; ref = ref->next)
>> +    {
>> +      if (ref->type == REF_COMPONENT
>> +           && ref->u.c.component->ts.type == BT_CLASS)
>> +       class_ref = ref;
>> +
>> +      if (ref->next == NULL)
>> +       break;
>> +    }
>>
>> ... I guess the last if statement is not needed, since this condition
>> is already checked by the for loop.
>
>
> No, it's not the same: As written, "ref" might be non-NULL after the loop,
> without, it will be always NULL.

That's true. However, it seems you don't use the value of 'ref' after
the loop exits ...

Thanks for the updated patch,
Janus


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