https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55735

--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Jürgen Reuter from comment #7)
> Ah sorry, I think I moved around the block data and then it wasn't valid
> Fortran anymore. I think, both the block data and the subroutine are
> external to the main program.

I do not understand how the processor is expected to lay out the common blocks
unless the string length appears after the pointer.

subroutine bar()
  character(len=:), pointer :: str(:)
  common /foo/ str
!  print *, len(str), '"'//str//'"' !ICE in gfc_conv_intrinsic_len
  print '(3a)', '"',str(1:6),'"' ! ICE in gfc_conv_variable
end

is unable to get the string length from anywhere otherwise.

As it happens, even
character(len=:), pointer :: str(:)
common /foo/ str
allocate (character(len=6) :: str(1))
str = "ABCDEF"
call bar()
end

ICEs unless the common statement is excised.

My original inclination was to close this as a WONTFIX but I will have a look.

Cheers

Paul

Reply via email to