This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/67987] ICE on declaring and initializing character with negative len
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Oct 2015 18:03:06 +0000
- Subject: [Bug fortran/67987] ICE on declaring and initializing character with negative len
- Auto-submitted: auto-generated
- References: <bug-67987-4 at http dot gcc dot gnu dot org/bugzilla/>
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.