Fortran: Fix character-kind=4 substring resolution (PR95837)

Thomas Koenig tkoenig@netcologne.de
Wed Jun 24 20:02:16 GMT 2020


Hi Tobias,

> could you review the second patch instead? I have sent the wrong patch 
> (early draft) and corrected it half an hour later!

Sorry, I missed that.  Here's the review of the real patch :-)

So, the first part is

+  if (ts)
+    e->ts.kind = ts->kind;

Ok, I unerstand that - ts has been set earlier for a component.

But this part

+  else if (e->ts.type != BT_CHARACTER)
+    e->ts.kind = gfc_default_character_kind;

I do not quite understand.  How can the type of an expression involving
a substring not be BT_CHARACTER when gfc_resolve_substring_charlen is
called?  Or is it BT_UNKNOWN, and a check for that might be better?
And, if it is indeed BT_UNKNOWN, how do we know it isn't a
CHARACTER(KIND=4)?

Best Regards

	Thomas




More information about the Gcc-patches mailing list