[Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

Janus Weil janus@gcc.gnu.org
Tue Oct 16 10:47:00 GMT 2012


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



More information about the Fortran mailing list