[Patch, fortran] PR38538 - ICE with elemental character function

Daniel Kraft d@domob.eu
Mon Mar 16 06:57:00 GMT 2009


Hi Paul,

Paul Richard Thomas wrote:
>> Not sure if I got this one correctly, but it seems to me this handles the
>> concatenation operator; if not, I do not see why we simply add the lengths
>> and are done.  If I'm right, maybe we should at least assert it here?
> 
> Well, I am adding the lengths but am converting the expressions
> recursively.  I haven't thought this through entirely but I suspect
> that this function might be the best general purpose character length
> calculator that we have.  I might just try rolling it out into other
> places that have cause trouble in the past.
> 
> Assert what, exactly?

As I understood the code in question, it calculates the character length 
of an EXPR_OP by adding both operands lengths'; this makes only sense 
for me if it is a concatenation operator.  I'm not 100% sure on this, 
but thinking briefly about it, it also seems that concatentation is the 
only binary operator that exists for strings, isn't it?

So everything is fine, but if it is really like that, I would prefer to 
have at least a comment saying that we're left with concatenation and 
thusly explain why we add both lengths.  Even better would be something like

gcc_assert (e->u.op.op == OP_CONCAT);
(with the names fixed accordingly)

If my assumption is not true, I would be happy to learn why we want to 
add both character lengths then, too :)

Cheers,
Daniel

-- 
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri



More information about the Fortran mailing list