This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] PR31879 , PR31197 , PR31258 & PR32703 - various character problems


Tobias Burnus wrote:
Of Tobias Schlüter's comments the following was not addressed:

+   for (; char_ref; char_ref = char_ref->next)
+     if (char_ref->type == REF_SUBSTRING)
+       break;

He wrote: "Further, it probably makes sense to assert that the reference
is indeed the last in the chain. "

Paul's reply was: "(ii) I will change the initialization of the loop and
assert that the REF_SUBSTRING is the last in the chain - I actually
removed this assert because it seems to be caught further upstream.
However, it canot do any harm"

I think it is ok like thus, but I would also not oppose if an assert
will be added.

I don't this particular check is worth much. As far as the function as a whole I think the Right Thing to do is:


{ ...
  if (!e->ref)
    return;

  for (char_ref = e->ref; char_ref->next; char_ref = char_ref->next)
    ;

  gcc_assert (char_ref->type == REF_SUBSTRING);
...

This looks much clearer to me. But if you're short on time, I don't think it's worth changing.

Cheers,
- Tobi


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