https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67987
Bug ID: 67987
Summary: ICE on declaring and initializing character with
negative len
Product: gcc
Version: 5.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Declaring and initializing a character with negative len (< -1)
requests memory of about 2^64 (= 18446744073709551616) :
$ cat z1.f90
program p
character(-8) :: c = ' '
end
$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z1.f90
f951: out of memory allocating 18446744073709551588 bytes after a total of
434176 bytes
---
Warning without assignment :
$ cat z2.f90
program p
character(-8) :: c
end
$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z2.f90
z2.f90:2:13:
character(-8) :: c
1
Warning: CHARACTER variable at (1) has negative length -8, the length has been
set to zero [-Wsurprising]
---
With len = -1, reaction depends on used compiler options :
$ cat z3.f90
program p
character(-1) :: c = 'c'
end
$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z3.f90
gfortran: internal compiler error: Segmentation fault (program f951)
---
Same issue with "character parameter".