[Bug fortran/41242] New: procedure pointer is not correctly recognized

reuter at physik dot uni-freiburg dot de gcc-bugzilla@gcc.gnu.org
Thu Sep 3 11:56:00 GMT 2009


When compiling the following code, gfortran does not correctly recognize a
procedure pointer and crashes with the following message:
no_func.f90:59.12:

  n_in  = prc_lib% get_n_in (2)
          1
Error: 'prc_lib' at (1) is not a function

I attach the code and also as attachment:
module iso_varying_string

  implicit none

  type, public :: varying_string
     private
     character(len=1), dimension(:), allocatable :: chars
  end type varying_string

  interface assignment(=)
     module procedure op_assign_VS_CH
  end interface assignment(=)

  public :: assignment(=)

contains

  elemental subroutine op_assign_VS_CH (string, char)
    type(varying_string), intent(out) :: string
    character(len=*), intent(in)      :: char
    integer                           :: i
    allocate(string%chars(LEN(char)))
    forall(i = 1:len(char))
       string%chars(i) = char(i:i)
    end forall
  end subroutine op_assign_VS_CH

end module iso_varying_string



module no_func

  use iso_varying_string, string_t => varying_string !NODEP!
  implicit none
  private

  type :: nf_t
     private
     procedure(prc_get_int), nopass, pointer :: get_n_in  => null ()
  end type nf_t


  abstract interface
     function prc_get_int (pid) result (n)
       import
       integer, intent(in) :: pid
       integer :: n
     end function prc_get_int
  end interface

contains

  subroutine no_func_config (prc_lib)
    type(nf_t), intent(inout), target :: prc_lib
    integer :: n_in
    type(string_t) :: prc_id
    prc_id = "foobar"
    n_in  = prc_lib% get_n_in  (2)
  end subroutine no_func_config

end module no_func


-- 
           Summary: procedure pointer is not correctly recognized
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reuter at physik dot uni-freiburg dot de
 GCC build triplet: on Ubuntu Linux 2.6.27-7-generic Kernel i686 32bit
  GCC host triplet: gfortran 4.5.0 v151352


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41242



More information about the Gcc-bugs mailing list