https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85603
--- Comment #4 from Walter Spector <w6ws at earthlink dot net> ---
Hi Paul,
I built an updated compiler that includes your fix. The ICE is gone - thanks!
However the assignment is still not correctly compiled.
The example should be reallocating the character string length of the array to
15. Unfortunately it remains at 32. Slightly longer example:
program strlen_bug
implicit none
character(:), allocatable :: strings(:)
integer :: maxlen
strings = [ character(32) :: &
'short', &
'somewhat longer' ]
maxlen = maxval (len_trim (strings))
print *, 'max length =', maxlen
! Used to cause an ICE
strings = strings(:)(:maxlen) ! Should realloc
print *, strings
print *, 'string length =', len (strings)
end program
wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ /usr/local/gcc-9/bin/gfortran
-frealloc-lhs strlen_bug.f90
wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ a.out
max length = 15
short somewhat longer
string length = 32
wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$ /usr/local/gcc-9/bin/gfortran
--version
GNU Fortran (GCC) 9.0.0 20180922 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
wws@w6ws-4:/rootsda5/home/wws/fortran/gfortran$
Note that I tried explicitly adding the -frealloc-lhs option, but it didn't
make a difference either way.