compiler-errorsfortranfortran90gfortranfortran-iso-c-binding

How to debug Fortran 90 compile error "There is no specific subroutine for the generic 'foo' at (1)"?


I am trying to write Fortran 2003 bindings to CUFFT library using iso_c_bindings module, but I have problems with cufftPlanMany subroutine (similar to sfftw_plan_many_dft in FFTW library).

The bindings itself look like this:


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! cufftResult cufftPlanMany(cufftHandle *plan, int rank, int *n,
!                           int *inembed, int istride, int idist,
!                           int *onembed, int ostride, int odist,
!                           cufftType type, int batch)
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

interface cufftPlanMany
subroutine cufftPlanMany(plan, rank, n, &
                         inembed, istride, idist, &
                         onembed, ostride, odist, &
                         type, batch) &
& bind(C,name='cufftPlanMany')
use iso_c_binding
integer(c_int):: plan
integer(c_int),value:: rank, type, batch
integer(c_int):: n(*)
integer(c_int),value:: istride, idist, ostride, odist
integer(c_int):: inembed(*), onembed(*)
end subroutine cufftPlanMany
end interface cufftPlanMany

The calling part looks like this:


  integer(c_int):: plan
  integer(c_int):: batch
  integer(c_size_t):: size

! ...

    call cufftPlanMany(plan, 1, size,&
                       0, 1, size,&
                       0, 1, size,&
                       CUFFT_C2C, batch)

Unfortunately trying to compile this results in

Error: There is no specific subroutine for the generic 'cufftplanmany' at (1)

compilation error. Trying to use variables in place of constants didn't help either. Could you help with debugging this?

The compiler used is gfortran: GNU Fortran (Gentoo 4.4.5 p1.2, pie-0.4.5) 4.4.5


Solution

  • Try giving the interface and the subroutine different names, i.e., rename the interface.