Prototype doesn't match for....

Hi,

I have an issue with the pgfortran compiler, version 1.3 on Linux.

I am getting an error message ’ nvlink error: Prototype doesn’t match for ‘kernel_functions_grad_w_cubic_corrected_’ when linking my code - attached below.

I think this is because I am being tricky and returning an array of values from a function. Could you let me know if this is the case and if there is any way to get this to work?

Thanks in advance

Tim.

!   -------------------------------------------------------  
      function grad_w_cubic_corrected(r,h,dx,dy,dz,ci) 
      
      !$acc routine seq

      real*4 dx,dy,dz,h
      
      real*4 ci(2:4,1:4)
      
      real*4 r,q,pi,norm_val,w_cubic
      
      real*4 gx_correction_val 
      real*4 gy_correction_val 
      real*4 gz_correction_val 
      
      real, dimension(3) :: grad_w_cubic_corrected
      

      pi = 3.1415926535897932384626433832795028841971693993
      
      q = r/h
            
      norm_val = 3.0/(2.0*pi*h*h*h) ! 3-d

      if(q.gt.0.0.and.q.le.1.0) then      

       w_cubic = norm_val * ((2.0/3.0) - (q*q) + (0.5*q*q*q))
           
      elseif(q.gt.1.0.and.q.le.2.0) then 

       w_cubic = norm_val * ((1.0/6.0) * ((2.0-q)**3.0))
           
      else

       w_cubic = 0.00

      endif
      
      gx_correction_val = ci(2,1) + (ci(2,2)*dx) +                    &
                                        (ci(2,3)*dy)  + (ci(2,4)*dz) 
                                        
                                        
      gy_correction_val = ci(3,1) + (ci(3,2)*dx) +                    &
                                        (ci(3,3)*dy)  + (ci(3,4)*dz) 
                                        
                                        
      gz_correction_val = ci(4,1) + (ci(4,2)*dx) +                    &
                                        (ci(4,3)*dy)  + (ci(4,4)*dz) 
      
      
      
      grad_w_cubic_corrected(1) = w_cubic * gx_correction_val * -1.0  
      
      grad_w_cubic_corrected(2) = w_cubic * gy_correction_val * -1.0  
      
      grad_w_cubic_corrected(3) = w_cubic * gz_correction_val * -1.0  
      
      
      end function grad_w_cubic_corrected
      
!   -------------------------------------------------------

Hi Tim,

I was able to recreate the error here and have assigned it to TPR#21688. The generated device code all looks ok to me, so I’ll need to have one of the compiler engineers investigate why the error occurs.

Unfortunately, the only work around I can find is to pass in an array rather than returning it.

Also, if you can, please send a reproducing example to PGI Customer Service (trs@pgroup.com). While I think I replicated the issue, it’s always nice to have the original problem just in case.

Thanks,
Mat

Hi Mat,

I have emailed you files to form a reproducing example.

Thanks for your help :-)

Tim.