CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Compile error in KIVA 3v with gfortran (https://www.cfd-online.com/Forums/main/68440-compile-error-kiva-3v-gfortran.html)

ottbot September 20, 2009 06:37

Compile error in KIVA 3v with gfortran
 
I'm trying to build kiva 3v on OS X using gfortran. I had the same code compiling with intel fortran compiler, using XCode so I didn't see compiler options ifort was using.

Anyway, with gfortran I get the follow error I can't seem to find much information on:
Code:

begin.F:51.18:

      call second(tstart)                                             
                1
Error: 'time' argument of 'second' intrinsic at (1) must be of kind 4

This is repeated several times (for each call of second it seems like). Here's the full output from the compiler.

http://gist.github.com/189768

The second looks like this:
Code:

      subroutine second (tnow)
      real*4 d(2)
      rtnow=etime(d)
      tnow=d(1)+d(2)
      return
      end

Does this indicate a problem the variable in the subroutine, or the variable being passed to it externally? Is there an option I can use to relax this "must be kind 4" requirement?

I'm at a loss of how to proceed, any advice is appreciated!

ottbot October 1, 2009 07:10

I'm hoping someone could take another look at this - the following program will show what's happening.


Code:

      program sec
          implicit double precision (a-h,o-z)         
       
          call second(tbegin)
      end program sec

      subroutine second (tnow)
          real*4 d(2)
          rtnow=etime(d)
          tnow=d(1)+d(2)
          return
      end

Compiling does this:
Code:

rob@cosmo test $ gfortran second.F
second.F:4.22:

          call second(tbegin)                                         
                    1
Error: 'time' argument of 'second' intrinsic at (1) must be of kind 4

If I add "real tbegin" or "real*4 tbegin" in the main program, it works as expected..

However I'm looking for a way to modify just the subroutine to get it working - as second() is used all over the place in kiva. Any thoughts?

Thanks again!

tonse2003 October 1, 2009 22:08

Subroutine Second
 
I guess you have solved your problem by now, but here goes anyway:
The gfortran compiler thinks that Second() is an Intrinsic function, (and it probably is for gfortran.)
Solution: Rename the subroutine in second.f to be something else, say, Ksecond.
Also rename the Calls to Second to be Call Ksecond.
That fixes it.


All times are GMT -4. The time now is 04:34.