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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 46375
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46375&action=edit
Patch for the problem

I very much doubt that this was revision r257065. The problem looks to have
Andre's signature on it. Nevertheless, I have the fix attached and have taken
it.

  type field_names_a
    class(*), pointer :: var(:) =>null()
  end type

  type(field_names_a),pointer :: a(:)
  allocate (a(1))

  allocate (a(1)%var(2), source = ["hello"," baby"])
  call s(a)
  deallocate (a(1)%var)
  deallocate (a)
contains
  subroutine s(a)

    type(field_names_a) :: a(:)

    select type (var => a(1)%var)
      type is (character(*))
        print *, var
      class default
        stop
    end select
    associate (var => a(i)%var)
      select type (var2 => a(1)%var)
        type is (character(*))
          print *, var2
        class default
          stop
      end select
    end associate
  end
end

Does the right thing mostly but sometimes, after recompilation, segfaults at
runtime - I will check out why before submitting.

Paul

Reply via email to