error with function declaration

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Aug 25 15:14:00 GMT 2007


On Sat, Aug 25, 2007 at 01:14:02AM +0200, Marcello Vichi wrote:
> 
> However, I get an error with gfortran (linux and mac) when I have 
> functions declared in this way
> 
>       REAL(RLEN) FUNCTION BESS_EXP(X,LAMBDA,FN)
>         USE global_mem, ONLY:RLEN
>         USE constants
>         IMPLICIT  NONE
> 
> where RLEN is declared as
>   MODULE global_mem
>   INTEGER, PARAMETER :: RLEN=kind(1.D0)
> 
> The reported error is:
>       REAL(RLEN) FUNCTION BESS_EXP(X,LAMBDA,FN)
>           1
> Error: Parameter 'rlen' at (1) has not been declared or is a variable, 
> which does not reduce to a constant expression

> Does anyone have an idea of what I'm doing wrong?

It's a known bug.  I don't recall the bugzilla number.  You 
can work aroound the problem by changing the code to

       FUNCTION BESS_EXP(X,LAMBDA,FN)
         USE global_mem, ONLY:RLEN
         USE constants
         IMPLICIT  NONE
         REAL(RLEN) BESS_EXP
 
-- 
Steve



More information about the Fortran mailing list