subprogram not inlined -- type mismatch

I’m attempting to use -Mipa=inline to inline functions from one fortran module into the main program so that I can use that function within an accelerator region. I’m getting the following error though from the IPA:

81, subprogram not inlined -- type mismatch: laplace_sphere_wk, argument 3



  function laplace_sphere_wk(s,deriv,elem) result(laplace)
    real(kind=real_kind), intent(in) :: s(nv,nv)
    type (derivative_t)              :: deriv
    type (element_t)                 :: elem
    real(kind=real_kind) :: laplace(nv,nv)

    ...
  end function laplace_sphere_wk

program driver
  type (element_t),allocatable,dimension(:)   :: elem(:)
  ...

    do ie=nets, nete
      do q=1,qsize
        do k=1,nlev
          laplace5d(:,:,k,q,ie) = laplace_sphere_wk( s5d(:,:,k,q,ie) , deriv, elem(ie) )
        enddo
      enddo
    enddo
end program

The subroutine expects 1 element_t, the caller passes in 1 element_t from an array. There’s some subtlety here that I’m missing. Does anyone have an idea of how I can make this inline?

Thanks!

I’m trying to reproduce this example now, I’ll let you know what I learn.

OK, now I’m able to reproduce the problem with a simple example. It’s apparently got something to do with derived types declared in a module. Is laplace_sphere_wk defined in a module? If so, then I think I understand what’s happening and can move forward.

Yes, this is declared in a module and the element_t derived type in a separate module. I can send you the original code, if you’d like, but it sounds like you’ve already created a simple test case. Thanks for looking at this.

This inlining problem should be fixed in the next monthly build, 11.8 due out in early August. Thanks for the report!