https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119827
kargls at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargls at comcast dot net
--- Comment #1 from kargls at comcast dot net ---
Perhaps, a review of the Fortran standard is in order.
F2023, 9.4.1
R910 substring-range is [ scalar-int-expr ] : [ scalar-int-expr ]
The value of the first scalar-int-expr in substring-range is the starting
point
of the substring and the value of the second one is the ending point of the
substring. The length of a substring is the number of characters in the
substring and is MAX (l - f + 1, 0), where f and l are the starting and
ending points, respectively.
Let the characters in the parent string be numbered 1, 2, 3, ..., n, where n
is the length of the parent string. Then the characters in the substring
are
those from the parent string from the starting point and proceeding in
sequence
up to and including the ending point. If the starting point is greater than
the ending point, the substring has length zero; otherwise, both the
starting
point and the ending point shall be within the range 1, 2, ..., n. If the
starting point is not specified, the default value is 1. If the ending point
is not specified, the default value is n.
! This does not raise a compilation or runtime error
print *, 'MYSTR3= ', mystr(1:1-1)
1 > 0, so you have zero-length substrin
! This will not raise an error either...
print *, 'MYSTR4= ', mystr(1:i-1) ! i-1=0
1 > 0, so you have ...
! ... nor does this...
i=-1
print *, 'MYSTR5= ', mystr(1:i)
1 > -1, so you have ...