[PATCH] PR fortran/67987 -- character lengths cannot be negative
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Oct 16 21:27:00 GMT 2015
On Fri, Oct 16, 2015 at 10:17:34PM +0200, FX wrote:
> > The attach patch enforces the Fortran Standard's requirement
> > that character length must be great than or equal to zero.
>
> 4.4.3.2. "If the character length parameter value evaluates to
> a negative value, the length of character entities declared is zero."
>
Thanks. I missed the above. The above text goes back to
at least F90 (see p. 41 on N693.pdf). New diff attached.
2015-10-16 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67987
* decl.c (char_len_param_value): Unwrap unlong line. If LEN < 0,
then force it to zero pre Fortran Standards.
* resolve.c (gfc_resolve_substring_charlen): Unwrap unlong line.
If 'start' is larger than 'end', then length of string is negative,
so explicitly set it to zero.
(resolve_charlen): Remove -Wsurprising warning. Update comment to
text from F2008 standard.
2015-10-16 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67987
* gfortran.dg/char_length_2.f90: Add declaration from PR to testcase.
--
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr67987.diff
Type: text/x-diff
Size: 5173 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20151016/2ee132c2/attachment.bin>
More information about the Fortran
mailing list