This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: Dominique Dhumieres <dominiq at lps dot ens dot fr>, fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 Oct 2012 12:47:49 +0200
- Subject: Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism
- References: <20121007103940.B9EB93BABA@mailhost.lps.ens.fr> <507D37C2.9070501@net-b.de>
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