inline question
Steve Kargl
sgk@troutmask.apl.washington.edu
Tue Oct 28 23:21:00 GMT 2008
On Tue, Oct 28, 2008 at 04:13:16PM -0700, Mike Kumbera wrote:
> I'm having troubles understanding how to get gfortran to inline a
> subroutine. This is a simplified example but if I can't inline a
> function that
> does a=a+b then I don't have hope for any other functions. What am
> I doing wrong? (This example rewritten for gcc DOES inline the function
> call.)
>
IIRC, gfortran will only in-line contained subroutines. Youir code
should look like
> program sum_test
> implicit none
> real*8 ar,br, cr, cr1
> integer k
>
> ar=1.d0
> br=1.d0
> cr1=1.d0
> do k = 1, 2000000000
> call simple_add(cr1,br)
> enddo
>
contains
subroutine simple_add (dda, ddb)
implicit none
real*8 dda,ddb
dda = dda + ddb
return
end subroutine
> end
>
--
Steve
More information about the Fortran
mailing list