[Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated

juergen.reuter at desy dot de gcc-bugzilla@gcc.gnu.org
Mon Mar 15 23:07:19 GMT 2021


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

Jürgen Reuter <juergen.reuter at desy dot de> changed:

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

--- Comment #3 from Jürgen Reuter <juergen.reuter at desy dot de> ---
Here is a shorter reproducer, and this time it is the -fcheck=pointer that
leads to the problem. I was able to reproduce this to 80 lines, leading to the
error:
At line 41 of file repro.f90
Fortran runtime error: Pointer actual argument 'm2' is not associated

module m
  implicit none
  private
  public :: m_t
  type :: m_t
     private
  end type m_t
end module m

module m2_testbed
  use m
  implicit none
  private
  public :: prepare_m2
  procedure (prepare_m2_proc), pointer :: prepare_m2 => null ()

  abstract interface
     subroutine prepare_m2_proc (m2)
       import
       class(m_t), intent(inout), pointer :: m2
     end subroutine prepare_m2_proc
  end interface

end module m2_testbed

module a
  use m
  use m2_testbed, only: prepare_m2
  implicit none
  private
  public :: a_1

contains

  subroutine a_1 ()
    class(m_t), pointer :: m2
    m2 => null ()
    call prepare_m2 (m2)
  end subroutine a_1

end module a


module m2
  use m
  implicit none
  private
  public :: m2_t

  type, extends (m_t) :: m2_t
     private
   contains
     procedure :: read => m2_read
  end type m2_t
contains

  subroutine m2_read (m2)
    class(m2_t), intent(out), target :: m2
  end subroutine m2_read
end module m2

program main
  use m2_testbed
  use a, only: a_1
  implicit none
  prepare_m2 => prepare_whizard_m2
  call a_1 ()

contains

  subroutine prepare_whizard_m2 (m2)
    use m
    use m2
    class(m_t), intent(inout), pointer :: m2
    select type (m2)
    type is (m2_t)
       call m2%read ()
    end select
  end subroutine prepare_whizard_m2
end program main


More information about the Gcc-bugs mailing list