Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compile problem

Status
Not open for further replies.

nudols

MIS
Oct 31, 2006
5
IT
i'm trying to compile the CALMET/CALPUFF modelling system on linux box
with gfortran compiler and keep getting any errors.The code compiles and runs okay on a PC
using a Lahey compiler.

the ultime error i find:

calpuff.for: In function 'r1mach':
calpuff.for:53679: fatal error: gfc_todo: Not Implemented: Initialization of overlapping variables
compilation terminated.

this is the function:

REAL FUNCTION R1MACH (I)
C***BEGIN PROLOGUE R1MACH
C***PURPOSE Return floating point machine dependent constants.
C***LIBRARY SLATEC
C***CATEGORY R1
C***TYPE SINGLE PRECISION (R1MACH-S, D1MACH-D)
C***KEYWORDS MACHINE CONSTANTS
C***AUTHOR Fox, P. A., (Bell Labs)
C Hall, A. D., (Bell Labs)
C Schryer, N. L., (Bell Labs)
C***DESCRIPTION
C
C R1MACH can be used to obtain machine-dependent parameters for the
C local machine environment.




real SMALL(2)
real LARGE(2)
real RIGHT(2)
real DIVER(2)
real LOG10(2)

REAL RMACH(5)
SAVE RMACH

EQUIVALENCE (RMACH(1),SMALL(1))
EQUIVALENCE (RMACH(2),LARGE(1))
EQUIVALENCE (RMACH(3),RIGHT(1))
EQUIVALENCE (RMACH(4),DIVER(1))
EQUIVALENCE (RMACH(5),LOG10(1))

DATA SMALL(1) / 1.18E-38 /
DATA LARGE(1) / 3.40E+38 /
DATA RIGHT(1) / 0.595E-07 /
DATA DIVER(1) / 1.19E-07 /
DATA LOG10(1) / 0.30102999566 /

i have Linux version 2.6.12-12mdk Mandriva Linux release 2006.0
CPU: AMD Turion(tm) 64 Mobile Technology ML-34 stepping 02
gfortran -v
Using built-in specs.
Target: x86_64-mandriva-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib64 --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-languages=c,c++,ada,f95,objc,java --host=x86_64-mandriva-linux-gnu --with-system-zlib --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --disable-libunwind-exceptions --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo --disable-libjava-multilib
Thread model: posix
gcc version 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0)


thank you for any ideas
 
I think that it's complaining that the variables in the EQUIVALENCE are initialized by the DATA statements.

And the compiler hasn't got that bit incorporated.

You could try

SMALL( 1 ) = 1.18E-38

etc. and see what happens.

If it's more than that, I haven't a clue...
 
REAL FUNCTION R1MACH (I)
C***BEGIN PROLOGUE R1MACH
C***PURPOSE Return floating point machine dependent constants.
C***LIBRARY SLATEC
C***CATEGORY R1
C***TYPE SINGLE PRECISION (R1MACH-S, D1MACH-D)
C***KEYWORDS MACHINE CONSTANTS
C***AUTHOR Fox, P. A., (Bell Labs)
C Hall, A. D., (Bell Labs)
C Schryer, N. L., (Bell Labs)
C***DESCRIPTION
C
C R1MACH can be used to obtain machine-dependent parameters for the
C local machine environment. It is a function subprogram with one
C (input) argument, and can be referenced as follows:
C
C A = R1MACH(I)
C
C where I=1,...,5. The (output) value of A above is determined by
C the (input) value of I. The results for various values of I are
C discussed below.
C
C R1MACH(1) = B**(EMIN-1), the smallest positive magnitude.
C R1MACH(2) = B**EMAX*(1 - B**(-T)), the largest magnitude.
C R1MACH(3) = B**(-T), the smallest relative spacing.
C R1MACH(4) = B**(1-T), the largest relative spacing.
C R1MACH(5) = LOG10(B)
C
C Assume single precision numbers are represented in the T-digit,
C base-B form
C
C sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
C
C where 0 .LE. X(I) .LT. B for I=1,...,T, 0 .LT. X(1), and
C EMIN .LE. E .LE. EMAX.
C
C The values of B, T, EMIN and EMAX are provided in I1MACH as
C follows:
C I1MACH(10) = B, the base.
C I1MACH(11) = T, the number of base-B digits.
C I1MACH(12) = EMIN, the smallest exponent E.
C I1MACH(13) = EMAX, the largest exponent E.
C
C To alter this function for a particular environment, the desired
C set of DATA statements should be activated by removing the C from
C column 1. Also, the values of R1MACH(1) - R1MACH(4) should be
C checked for consistency with the local operating system.
REAL RMACH(5)
SAVE RMACH
c aggiungo come da suggerimento
c la definizione SMALL(1)=1.18E-38
c
c
c
c new

SMALL(1)=1.18E-38

c fine aggiunta


EQUIVALENCE (RMACH(1),SMALL(1))
EQUIVALENCE (RMACH(2),LARGE(1))
EQUIVALENCE (RMACH(3),RIGHT(1))
EQUIVALENCE (RMACH(4),DIVER(1))
EQUIVALENCE (RMACH(5),LOG10(1))

C
C MACHINE CONSTANTS FOR THE IBM PC
c
DATA SMALL(1) / 1.18E-38 /
DATA LARGE(1) / 3.40E+38 /
DATA RIGHT(1) / 0.595E-07 /
DATA DIVER(1) / 1.19E-07 /
DATA LOG10(1) / 0.30102999566 /

new error:

In file calpuff.for:53769

EQUIVALENCE (RMACH(1),SMALL(1))
1
Error: Unexpected EQUIVALENCE statement at (1)
In file calpuff.for:53770

EQUIVALENCE (RMACH(2),LARGE(1))
1
Error: Unexpected EQUIVALENCE statement at (1)
In file calpuff.for:53771

EQUIVALENCE (RMACH(3),RIGHT(1))
1
Error: Unexpected EQUIVALENCE statement at (1)
In file calpuff.for:53772

EQUIVALENCE (RMACH(4),DIVER(1))
1
Error: Unexpected EQUIVALENCE statement at (1)
In file calpuff.for:53773

EQUIVALENCE (RMACH(5),LOG10(1))
1
Error: Unexpected EQUIVALENCE statement at (1)
 
Yes.

Move the SMALL(1)=1.82e-38 and the other 4 assignment statements AFTER the EQUIVALENCE statements.

It's getting upset because you've got data section stuff and program section stuff mixed together.

Comment out the existing DATA statements referring to the stuff in the EQUIVALENCE.

Code:
C    SMALL(1)=1.18E-38

c fine aggiunta


      EQUIVALENCE (RMACH(1),SMALL(1))
      EQUIVALENCE (RMACH(2),LARGE(1))
      EQUIVALENCE (RMACH(3),RIGHT(1))
      EQUIVALENCE (RMACH(4),DIVER(1))
      EQUIVALENCE (RMACH(5),LOG10(1))

C
C     MACHINE CONSTANTS FOR THE IBM PC
c
C      DATA SMALL(1) / 1.18E-38      /
C      DATA LARGE(1) / 3.40E+38      /
C      DATA RIGHT(1) / 0.595E-07     /
C      DATA DIVER(1) / 1.19E-07      /
C      DATA LOG10(1) / 0.30102999566 /

    SMALL(1)=1.18E-38
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top