[Bug fortran/53296] Segfault on non-constant character array constructor containing kind spec
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 9 00:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53296
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #4 from kargl at gcc dot gnu.org ---
This seems to have morphed into a strange off-by-1
in the array constructor. Consider this code,
program chararrerr
implicit none
character(len=128) :: str(2)
str = [ucase("abcde"), ucase("ghij")]
contains
function ucase(str)
character(*) :: str
character(len(str)) :: ucase
intent(in) :: str
ucase = str
print *, '>' // trim(str) // '<', len(str)
end function ucase
end program chararrerr
Trunk gives
% gfcx -o z a.f90 -fdump-tree-original && ./z
>abcde< 5
>abcde< 5
>ghij< 4
For some reason, the first element is evaluated twice.
More information about the Gcc-bugs
mailing list