[PATCH] PR fortran/67987 -- character lengths cannot be negative

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Oct 16 21:55:00 GMT 2015


On Fri, Oct 16, 2015 at 11:39:51PM +0200, FX wrote:
> > 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.
> 
> The patch is now mostly OK to me. Minor remarks:
> 
>   - I???m thinking you mean ???force it to zero per [not pre] Fortran standards???

yep.  Noticed that I was reading the fortran@ message it sent.

>   - why remove the -Wsurprising warning? it seems a good case for -Wsurprising: legal code, but dubious anyway
> 
> OK after you ponder that second point.
> 

F90 is over 26 years old.  There has been 3 major revisions that
have superceded F90 (F95, F03, and F08).  All of those revisions
include the text that you pointed out to me.  Why is it surprising
that a compiler conforms to the standard?  

"Simplify, simplify, simplify."  Henry David Thoreau

-- 
Steve



More information about the Fortran mailing list