This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR fortran/67987 -- character lengths cannot be negative
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: FX <fxcoudert at gmail dot com>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Oct 2015 15:59:51 -0700
- Subject: Re: [PATCH] PR fortran/67987 -- character lengths cannot be negative
- Authentication-results: sourceware.org; auth=none
- References: <20151016190831 dot GA81904 at troutmask dot apl dot washington dot edu> <E0AD3803-1E0A-410F-BA35-FA8B367716F5 at gmail dot com> <20151016212657 dot GA22421 at troutmask dot apl dot washington dot edu> <F03B2778-8CB2-427F-820D-0C1D8E5D4A62 at gmail dot com> <20151016215527 dot GA22635 at troutmask dot apl dot washington dot edu>
On Fri, Oct 16, 2015 at 02:55:27PM -0700, Steve Kargl wrote:
> On Fri, Oct 16, 2015 at 11:39:51PM +0200, FX wrote:
>
> > - 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
>
Another reason to remove it. It is no longer reached
for the first 2 of the 3 dg-warnings in char_length_2.f90.
% head -13 char_length_2.f90
! { dg-do link }
! { dg-options "-Wsurprising" }
! Tests the fix for PR 31250
! CHARACTER lengths weren't reduced early enough for all checks of
! them to be meaningful. Furthermore negative string lengths weren't
! dealt with correctly.
CHARACTER(len=0) :: c1 ! This is OK.
CHARACTER(len=-1) :: c2 ! { dg-warning "has negative length" }
PARAMETER(I=-100)
CHARACTER(len=I) :: c3 ! { dg-warning "has negative length" }
CHARACTER(len=min(I,500)) :: c4 ! { dg-warning "has negative length" }
CHARACTER(len=max(I,500)) :: d1 ! no warning
CHARACTER(len=5) :: d2 ! no warning
--
Steve