This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/67987] ICE on declaring and initializing character with negative len


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67987

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> I have a patch that I'm testing.  For the code in the
> intial report I get
> 
> troutmask:sgk[238] gfc6 -c g6.f90
> g6.f90:2:15:
> 
>     character(-8) :: c = ' '
>                1
> Error: LEN at (1) must be greater than or equal to 0

Seems the patch causes a regression for char_length_2.f90.
This test came in with the fix for PR fortran/31250, where
negative length parameters are silently set to 0.  The 
fix for this regression is in resolve.c.  Unfortnately, 
this fix then exposes an issue with substring referecences.
For "string"(1:-1), this should result in a 0 length string,
but gfortran is setting the length to -1 in 
gfc_resolve_substring_charlen.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]