https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87673
Bug ID: 87673 Summary: Errors caused by using function for character length in allocate with typespec Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: pault at gcc dot gnu.org Target Milestone: --- Created attachment 44873 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44873&action=edit Reduced source for the problem The attached causes a variety of failures, ranging from a segfault in resolve.c to the following message: [pault@pc30 pr85603]$ ~/irun/bin/gfortran -static-libgfortran -fdump-tree-original ~/prs/pr85603/f*.f90 -g /home/pault/prs/pr85603/fragment.f90:46:24: 46 | ALLOCATE( CHARACTER(get_char_result_length(len(string%chars), length)) :: & | 1 Error: Reference to impure function ‘_chars_length’ at (1) within a PURE procedure /home/pault/prs/pr85603/fragment.f90:75:10: 75 | end module | 1 Warning: _chars_length at (1) is not a procedure If the assignment to 'klen' is included, the function identified changes to '__vtab_v_Varying_string'. Using 'klen' in the typespec, instead of the function call works fine. I have to drop the search for the source of the problem right now and so I am posting it. Paul