Could not resolve generic procedure

The PGI fortran compiler raises an error when we use a interface inside an implementation of an abstract type. I don’t think i break the norm but i am not sure.

I made a simple example :

The abstract type :

module example_abstract

type, abstract :: foo_parent
contains
  procedure(integer_interface), pass, deferred :: add_integer
  procedure(real_interface), pass, deferred :: add_real
end type foo_parent

abstract interface
  subroutine integer_interface(this,x)
    import foo_parent
    class(foo_parent) :: this
    integer :: x
   end subroutine
end interface

abstract interface
  subroutine real_interface(this,x)
    import foo_parent
    class(foo_parent) :: this
    real :: x
  end subroutine
end interface

end module example_abstract

The implementation :

module example_module
use example_abstract
implicit none

type, extends(foo_parent) :: foo_child
  integer :: int_part = 0
  real    :: real_part = 0.0
contains
  procedure :: add_integer  => add_integer_child
  procedure :: add_real => add_real_child
  generic   :: add => add_integer, add_real
end type foo_child

interface add
  module procedure add_integer_child, add_real_child
end interface add

contains

subroutine add_integer_child(this,x)
  class(foo_child) :: this
  integer          :: x

  print *,this%int_part+x

end subroutine add_integer_child

subroutine add_real_child(this,x)
  class(foo_child) :: this
  real             :: x

  print *,this%real_part+x

end subroutine add_real_child

end module example_module

The main program:

program example_program
use example_module
implicit none
type(foo_child) :: my_foo

call my_foo%add(1)
call my_foo%add(2.)

call add(my_foo,1)
call add(my_foo,2.)

end program example_program

The result should be

$ ./a.out
1
2.000000
1
2.000000

But complier says :


$ pgfortran --version

pgfortran 14.10-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.

$ pgfortran *.F90
example_abstract.F90:
example_module.F90:
example_program.F90:
PGF90-S-0155-Could not resolve generic procedure add (example_program.F90: 9)
PGF90-S-0155-Could not resolve generic procedure add (example_program.F90: 10)
0 inform, 0 warnings, 2 severes, 0 fatal for example_program

Thanks Pierre. I’ve recreated the issue here and sent it on to our engineers for further evaluation. The issue is being tracked as TPR#21154.

Best Regards,
Mat

TPR 21154 - UF: Syntax error “Could not resolve generic procedure” when using an interface in anabstract type

has been fixed in the current release.

thanks,
dave