https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83522
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> --- Created attachment 44809 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44809&action=edit Patch (two variants) The attached patch takes care of this - I forgot to add the ref to the standard (R908 in F2018). The primary.c patch directly tackles it at parse level. The patch is not as nice but it provides a nicer error location and also handles: 7 | strings(:)(:) ! gives an error message on invalid | 1 Error: Substring reference of nonscalar not permitted at (1) On the other hand, the resolve.c patch seems to be cleaner, but the error location is not that nice (points one character left(!) of "string(:)(:)") 6 | write(*,*)strings(:)(:) ! gives an ICE on invalid | 1 Error: Substring reference of nonscalar not permitted at (1) And prints for the case above (not affected by resolve.c patch): 7 | strings(:)(:) ! gives an error message on invalid | 1 Error: Invalid character in name at (1)