Request for comment: Character substring lengths
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Sat May 5 17:27:00 GMT 2007
Brooks Moses wrote:
> Tobias Schlüter wrote:
>> FX Coudert wrote:
>> > I think there might be lots of places in the front-end relying on this
>> > convention. A grep for "ts.cl " reveals a few trivial ones, but I
>> > think there might be more...
>>
>> Indeed, I found about this recently when I prepared my last series of
>> patches. I think I wrote something about this in one of my patch
>> submissions, but I couldn't find it, so I may only have it in my
>> private notes. I will check later today if I kept them, as I then
>> believed to have understood the mechanism behind charlenghths.
>
> If you find something, could you put it in gfc_internals.texi? :)
It was the patch for PR31266 that made me look at these things. There's
not much in my notes. Basically, ts.cl == NULL means length unknown.
This of course bears the question if ts.cl == NULL implies ts.cl->length
== NULL, in which case the double checks for the negative of both
conditions would be redundant.
> There's also the complication that constant character expressions don't
> have ts.cl. (Or, at least, they don't reliably have it; I'm not at all
> sure of the details.) Instead, they have value.character.length.
I think the assumption is that the length of an EXPR_CONSTANT is always
expr->value.character.length, and no gfc_charlen is needed for these.
Whether that is the best way to organize this, I don't know.
- Tobi
More information about the Fortran
mailing list