Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28593 Discussions

Compiler runs into problem compiling F77 code

Jason_Z_
Beginner
488 Views

I'm trying to compile Fortran 77 code (T-matrix code) on a Linux system using Intel Parallel Studio XE 2015 for Fortan and I have the recurring problem of too many errors.

I'm using: ifort ampld.new.f

and the errors that come up are:

ampld.new.f(1): error #5149: Illegal character in statement label field 
This test result was calculated by the code in its
^
ampld.new.f(1): error #5149: Illegal character in statement label field 
This test result was calculated by the code in its
-^
ampld.new.f(1): error #5149: Illegal character in statement label field 
This test result was calculated by the code in its
--^
ampld.new.f(1): error #5149: Illegal character in statement label field 
This test result was calculated by the code in its
---^
ampld.new.f(1): error #5118: First statement in file must not be continued
This test result was calculated by the code in its
-----^
ampld.new.f(4): error #5149: Illegal character in statement label field 
ICHOICE=1  NCHECK=1
^
ampld.new.f(4): error #5149: Illegal character in statement label field 
ICHOICE=1  NCHECK=1
-^
ampld.new.f(4): error #5149: Illegal character in statement label field 
ICHOICE=1  NCHECK=1
--^
ampld.new.f(4): error #5149: Illegal character in statement label field 
ICHOICE=1  NCHECK=1
---^
ampld.new.f(4): error #5149: Illegal character in statement label field 
ICHOICE=1  NCHECK=1
----^
ampld.new.f(5): error #5149: Illegal character in statement label field 
RAT= .963711
^
ampld.new.f(5): error #5149: Illegal character in statement label field 
RAT= .963711
-^
ampld.new.f(5): error #5149: Illegal character in statement label field 
RAT= .963711
--^
ampld.new.f(5): error #5149: Illegal character in statement label field  [=]
RAT= .963711
---^
ampld.new.f(6): error #5149: Illegal character in statement label field 


PROLATE SPHEROIDS, A/B=   .5000000
^
ampld.new.f(6): error #5149: Illegal character in statement label field 
PROLATE SPHEROIDS, A/B=   .5000000
-^
ampld.new.f(6): error #5149: Illegal character in statement label field 
PROLATE SPHEROIDS, A/B=   .5000000
--^
ampld.new.f(6): error #5149: Illegal character in statement label field 
PROLATE SPHEROIDS, A/B=   .5000000
---^
ampld.new.f(6): error #5149: Illegal character in statement label field 
PROLATE SPHEROIDS, A/B=   .5000000
----^
ampld.new.f(7): error #5149: Illegal character in statement label field 
LAM=  6.283185   MRR= .1500D+01   MRI= .2000D-01
^
ampld.new.f(7): error #5149: Illegal character in statement label field 
LAM=  6.283185   MRR= .1500D+01   MRI= .2000D-01
-^
ampld.new.f(7): error #5149: Illegal character in statement label field 
LAM=  6.283185   MRR= .1500D+01   MRI= .2000D-01
--^
ampld.new.f(7): error #5149: Illegal character in statement label field  [=]
LAM=  6.283185   MRR= .1500D+01   MRI= .2000D-01
---^
ampld.new.f(4): error #5082: Syntax error, found IDENTIFIER 'NCHECK' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
ICHOICE=1  NCHECK=1
-----------^
ampld.new.f(8): error #5149: Illegal character in statement label field 
ACCURACY OF COMPUTATIONS DDELT =  .10D-02
^
ampld.new.f(8): error #5149: Illegal character in statement label field 
ACCURACY OF COMPUTATIONS DDELT =  .10D-02
-^
ampld.new.f(8): error #5149: Illegal character in statement label field 
ACCURACY OF COMPUTATIONS DDELT =  .10D-02
--^
ampld.new.f(8): error #5149: Illegal character in statement label field 
ACCURACY OF COMPUTATIONS DDELT =  .10D-02
---^
ampld.new.f(8): error #5149: Illegal character in statement label field 
ACCURACY OF COMPUTATIONS DDELT =  .10D-02
----^
ampld.new.f(9): error #5149: Illegal character in statement label field 
EQUAL-SURFACE-AREA-SPHERE RADIUS= 10.0000
^
ampld.new.f(10): catastrophic error: Too many errors, exiting
compilation aborted for ampld.new.f (code 1)

I'm very new to Fortran and compiling code, so I have no idea where my problem arises.

Iv'e tried renaming the file to .f90 and the errors that come up for the .f90 compilation are:

ampld.new.f90(1): error #5082: Syntax error, found IDENTIFIER 'TEST' when expecting one of: ( % [ : . = =>
This test result was calculated by the code in its
-----^
ampld.new.f90(2): error #5082: Syntax error, found IDENTIFIER 'SETTING' when expecting one of: ( % [ : . = =>
curent setting.
-------^
ampld.new.f90(4): error #5082: Syntax error, found IDENTIFIER 'NCHECK' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
ICHOICE=1  NCHECK=1
-----------^
ampld.new.f90(6): error #5082: Syntax error, found IDENTIFIER 'SPHEROIDS' when expecting one of: ( % [ : . = =>
PROLATE SPHEROIDS, A/B=   .5000000
--------^
ampld.new.f90(6): error #5082: Syntax error, found '=' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . % (/ + - [ : ] /) . ' ** / ...
PROLATE SPHEROIDS, A/B=   .5000000
----------------------^
ampld.new.f90(7): error #5082: Syntax error, found IDENTIFIER 'MRR' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
LAM=  6.283185   MRR= .1500D+01   MRI= .2000D-01
-----------------^
ampld.new.f90(8): error #5082: Syntax error, found IDENTIFIER 'OF' when expecting one of: ( % [ : . = =>
ACCURACY OF COMPUTATIONS DDELT =  .10D-02
---------^
ampld.new.f90(9): error #5082: Syntax error, found '-' when expecting one of: ( % [ : . = =>
EQUAL-SURFACE-AREA-SPHERE RADIUS= 10.0000
-----^
ampld.new.f90(9): error #5082: Syntax error, found IDENTIFIER 'RADIUS' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . % (/ + - [ : ] /) . ' ** / ...
EQUAL-SURFACE-AREA-SPHERE RADIUS= 10.0000
--------------------------^
ampld.new.f90(10): error #5082: Syntax error, found IDENTIFIER 'THET' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
thet0= 56.00  thet= 65.00  phi0=114.00  phi=128.00  alpha=145.00  beta= 52.00
--------------^
ampld.new.f90(11): error #5082: Syntax error, found IDENTIFIER 'MATRIX' when expecting one of: ( % [ : . = =>
AMPLITUDE MATRIX
----------^
ampld.new.f90(16): error #5082: Syntax error, found IDENTIFIER 'MATRIX' when expecting one of: ( % [ : . = =>
PHASE MATRIX
------^
ampld.new.f90(17): error #5082: Syntax error, found '.' when expecting one of: BLOCK PROGRAM BLOCKDATA MODULE INTEGER REAL COMPLEX TYPE BYTE CHARACTER CLASS ...
  650.3172  -17.9846   10.0498  -12.7580
-----^
ampld.new.f90(18): error #5082: Syntax error, found '-' when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK PROGRAM BLOCKDATA MODULE INTEGER REAL COMPLEX ...
  -21.1462  631.6322 -127.3059   87.2144
--^
ampld.new.f90(19): error #5082: Syntax error, found '.' when expecting one of: BLOCK PROGRAM BLOCKDATA MODULE INTEGER REAL COMPLEX TYPE BYTE CHARACTER CLASS ...
    6.8322  132.6131  635.2767  -34.7730
-----^
ampld.new.f90(20): error #5082: Syntax error, found '-' when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK PROGRAM BLOCKDATA MODULE INTEGER REAL COMPLEX ...
   -9.6629  -78.1229   51.4094  643.1738
---^
ampld.new.f90(20): error #5082: Syntax error, found REAL_CONSTANT '51.4094' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
   -9.6629  -78.1229   51.4094  643.1738
-----------------------^
ampld.new.f90(21): error #5082: Syntax error, found IDENTIFIER 'MIN' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
 time =     .03 min
----------------^
ampld.new.f90(23): error #5082: Syntax error, found IDENTIFIER 'CALCULATION' when expecting one of: ( % [ : . = =>
C   CALCULATION OF THE AMPLITUDE AND PHASE MATRICES FOR                 
----^
ampld.new.f90(24): error #5082: Syntax error, found IDENTIFIER 'A' when expecting one of: ( % [ : . = =>
C   A PARTICLE WITH AN AXIALLY SYMMETRIC SHAPE                   
----^
ampld.new.f90(26): error #5082: Syntax error, found IDENTIFIER 'THIS' when expecting one of: ( % [ : . = =>
C   This version of the code uses DOUBLE PRECISION variables,          
----^
ampld.new.f90(27): error #5082: Syntax error, found IDENTIFIER 'IS' when expecting one of: ( % [ : . = =>
C   is applicable to spheroids, finite circular cylinders,            
----^
ampld.new.f90(28): error #5082: Syntax error, found IDENTIFIER 'CHEBYSHEV' when expecting one of: ( % [ : . = =>
C   Chebyshev particles, and generalized Chebyshev particles
----^
ampld.new.f90(28): error #5082: Syntax error, found IDENTIFIER 'GENERALIZED' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . % (/ + - [ : ] /) . ** / // ...
C   Chebyshev particles, and generalized Chebyshev particles
-----------------------------^
ampld.new.f90(29): error #5082: Syntax error, found IDENTIFIER 'WATER' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . % (/ + - [ : ] /) . ** / // ...
C   (distorted water drops), and must be used along with the 
---------------^
ampld.new.f90(29): error #5082: Syntax error, found IDENTIFIER 'MUST' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . % (/ + - [ : ] /) . ** / // ...
C   (distorted water drops), and must be used along with the 
---------------------------------^
ampld.new.f90(30): error #5082: Syntax error, found IDENTIFIER 'ACCOMPANYING' when expecting one of: ( % [ : . = =>
C   accompanying file ampld.par.f.                
----^
ampld.new.f90(32): error #5082: Syntax error, found IDENTIFIER 'LAST' when expecting one of: ( % [ : . = =>
C   Last update 08/06/2005                                               
----^
ampld.new.f90(34): error #5082: Syntax error, found IDENTIFIER 'THE' when expecting one of: ( % [ : . = =>
C   The code has been developed by Michael Mishchenko at the NASA      
----^
ampld.new.f90(35): error #5082: Syntax error, found IDENTIFIER 'GODDARD' when expecting one of: ( % [ : . = =>
C   Goddard Institute for Space Studies, New York.  The development    
----^
ampld.new.f90(37): catastrophic error: Too many errors, exiting
compilation aborted for ampld.new.f90 (code 1) 

 

Please help me understand how I can troubleshoot this problem.

0 Kudos
1 Reply
mecej4
Honored Contributor III
488 Views

If you downloaded the files from http://www.giss.nasa.gov/staff/mmishchenko/t_matrix.html, note that they have pre-pended the program output to ampld.new.f. Cut out those lines and put them into a separate file. 

When you see the compiler output a large number of messages, such as one or more per line of code, that is a sign that the input source file has become mangled in some way, and it is useful to view it with a text editor.

Renaming the file with .f90 as the suffix, while well-intentioned, made things worse because, in addition to the program output being stitched on to the beginning of the file, lines beginning with 'C', which are comment lines in fixed format Fortran source, are not valid in free format Fortran source. The compiler considers files with suffixes .f and .for as fixed format and those with .f90 as free format.

In order to link the program, you will need some version of the NAG Fortran library compatible with the Fortran compiler that you use. You may consider using their "New LAPACK-based T-matrix codes" instead, which work fine with MKL without needing the NAG library, and produce correct output when run with Intel Fortran.

0 Kudos
Reply