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

Sebastien Bardeau <bardeau at iram dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bardeau at iram dot fr

--- Comment #4 from Sebastien Bardeau <bardeau at iram dot fr> ---
I have pretty much the same kind of issue with gfortran 10.2.0 and 11.0.1
(20210426). The following code shows invalid results (printed lengths are 0).
Sometimes I even get a program crash. If the 'data1' component is a standalone
pointer (i.e. out of the derived type), I have no issue then.

program test2
  character(len=10), target, allocatable :: s(:)
  type :: pointer_typec0_t
    character(len=:), pointer :: data1(:)
  end type pointer_typec0_t
  type(pointer_typec0_t) :: co
  !
  allocate(s(3))
  s(1) = '1234567890'
  s(2) = 'qwertyuio '
  s(3) = 'asdfghjk  '
  !
  co%data1 => s
  !
  print *,len(co%data1(1)),len_trim(co%data1(1)),co%data1(1)
  print *,len(co%data1(2)),len_trim(co%data1(2)),co%data1(2)
  print *,len(co%data1(3)),len_trim(co%data1(3)),co%data1(3)
end program test2

Reply via email to