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

unable to compile f90 files - multiline string constant/continuation lines

psing51
New Contributor I
975 Views
Dear All,

I am trying to compile a fortran code using intel 17 compilers and facing issues. 
1. using the make utility
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> FC='mpiifort' make
cc -E  -DDM_PARALLEL  cmpcomm.F  > cmpcomm.f90
mpiifort -o cmpcomm.o -c -I../io_int  cmpcomm.f90
cmpcomm.F(89): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
     &  'CMP_INIT: illegal value of kind_REAL='
-----------------------------------------------^
cmpcomm.F(94): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
     &  'CMP_INIT: illegal value of kind_INTEGER='
--------------------------------------------------^
cmpcomm.F(154): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
     &
---------------^
cmpcomm.F(352): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(354): error #5082: Syntax error, found ',' when expecting one of: => = . [ % ( :
     &    process_rank_local,component_master_rank_local
----------------------------^
cmpcomm.F(366): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(351): error #7094: Unmatched parentheses within a character format specifier.   ['("*** CMP_SEND: process_rank_local=",i4," ]
     &    '("*** CMP_SEND: process_rank_local=",i4,"  ***"/'            &
----------------------------------------------------------^
cmpcomm.F(354): error #6793: The POINTER attribute is required.   [PROCESS_RANK_LOCAL]
     &    process_rank_local,component_master_rank_local
----------^
cmpcomm.F(365): error #7094: Unmatched parentheses within a character format specifier.   ['("*** CMP_SEND: illegal value of FlexLev",]
     &     '("*** CMP_SEND: illegal value of FlexLev",i9/'              &
--------------------------------------------------------^
cmpcomm.F(410): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(412): error #5082: Syntax error, found ',' when expecting one of: => = . [ % ( :
     &    process_rank_local,component_master_rank_local
----------------------------^
cmpcomm.F(424): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(409): error #7094: Unmatched parentheses within a character format specifier.   ['("*** CMP_SEND: process_rank_local=",i4," ]
     &      '("*** CMP_SEND: process_rank_local=",i4,"  ***"/'          &
------------------------------------------------------------^
cmpcomm.F(412): error #6793: The POINTER attribute is required.   [PROCESS_RANK_LOCAL]
     &    process_rank_local,component_master_rank_local
----------^
cmpcomm.F(423): error #7094: Unmatched parentheses within a character format specifier.   ['("*** CMP_SEND: illegal value of FlexLev",]
     &    '("*** CMP_SEND: illegal value of FlexLev",i9/ '              &
-------------------------------------------------------^
cmpcomm.F(471): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(473): error #5082: Syntax error, found ',' when expecting one of: => = . [ % ( :
     &    process_rank_local,component_master_rank_local
----------------------------^
cmpcomm.F(485): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(470): error #7094: Unmatched parentheses within a character format specifier.   ['("*** CMP_SEND: process_rank_local=",i4," ]
     &    '("*** CMP_SEND: process_rank_local=",i4,"  ***"/ '           &
----------------------------------------------------------^
cmpcomm.F(473): error #6793: The POINTER attribute is required.   [PROCESS_RANK_LOCAL]
     &    process_rank_local,component_master_rank_local
----------^
cmpcomm.F(484): error #7094: Unmatched parentheses within a character format specifier.   ['("*** CMP_SEND: illegal value of FlexLev",]
     &    '("*** CMP_SEND: illegal value of FlexLev",i9/ '              &
-------------------------------------------------------^
cmpcomm.F(530): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , )
     &
----------^
cmpcomm.F(532): error #5082: Syntax error, found ',' when expecting one of: => = . [ % ( :
     &    process_rank_local,component_master_rank_local
----------------------------^
cmpcomm.f90(1165): catastrophic error: Too many errors, exiting
compilation aborted for cmpcomm.f90 (code 1)
Makefile:19: recipe for target 'cmpcomm.o' failed
make: *** [cmpcomm.o] Error 1

for a start , i tried compiling files individually, 

user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> cc -E  -DDM_PARALLEL  cmpcomm.F  > cmpcomm.f90

now, on attempting compilation:
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort -c cmpcomm.f90
cmpcomm.F(89): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
     &  'CMP_INIT: illegal value of kind_REAL='
-----------------------------------------------^
cmpcomm.F(94): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
     &  'CMP_INIT: illegal value of kind_INTEGER='
--------------------------------------------------^
cmpcomm.F(154): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
     &
---------------^
I have attached the original file (cmpcomm_original.F.txt) with which i am facing issues.
 
I made some changes in the original source code (attached - cmpcomm_modified.F.txt) . On compiling the modified file  - 
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn_modified> cc -E  -DDM_PARALLEL  cmpcomm.F  > cmpcomm.f90
No supported cpu target is set, CRAY_CPU_TARGET=x86-64 will be used.
Load a valid targeting module or set CRAY_CPU_TARGET
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn_modifies> mpiifort -c cmpcomm.f90
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn_modifies> echo $?
0

Issue is that there are multiple such source files, example - 

user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn_modified> mpiifort  atm_comm.f90
atm_comm.F(156): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
      call ATM_ANNOUNCE('back from CMP_INTRO, VerbLev='
-------------------------------------------------------^
atm_comm.F(164): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
      call ATM_ANNOUNCE('back from CMP_INTEGER_RECV, OM spec is '
-----------------------------------------------------------------^
atm_comm.F(171): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
      call ATM_ANNOUNCE('back from CMP_INTEGER_RECV, WM id is '
---------------------------------------------------------------^
atm_comm.F(193): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
        call ATM_ANNOUNCE('AM is standalone: Ocean_spec=1, NSF=4'
-----------------------------------------------------------------^
atm_comm.F(194): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &  ' assigned (as if for POM coupling)',2)
--------^
atm_comm.F(194): error #5276: Unbalanced parentheses
     &  ' assigned (as if for POM coupling)',2)
----------------------------------------------^
atm_comm.F(194): error #5082: Syntax error, found ')' when expecting one of: , <END-OF-STATEMENT> ;
     &  ' assigned (as if for POM coupling)',2)
----------------------------------------------^
atm_comm.F(199): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
      call ATM_ANNOUNCE('back from CMP_INTEGER_RECV, ia2o is '
--------------------------------------------------------------^

Q: Am i missing out on any compilation flag which is causing issues with the original code ?.
Please let me know if any further information is required from my end.

Eagerly awaiting your reply.
0 Kudos
4 Replies
Juergen_R_R
Valued Contributor I
975 Views

I have no problems in compiling the code with either ifort, nor gfortran, nor gfortran-based mpifort. 

0 Kudos
psing51
New Contributor I
975 Views

Hi ,

I retried (with mpiifort as preprocessor), i got same error message.

user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort -E  -DDM_PARALLEL  cmpcomm.F  > cmpcomm.f90
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort  cmpcomm.f90
cmpcomm.F(148): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
      call MPI_RECV(ibuffer,ibuffer_size,MPI_INTEGER,MPI_ANY_SOURCE,tag,
------------------------------------------------------------------------^
cmpcomm.F(149): error #5276: Unbalanced parentheses
     &MPI_COMM_WORLD,status,ierr)
--------------------------------^
cmpcomm.F(149): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &MPI_COMM_WORLD,status,ierr)
------^
cmpcomm.F(149): error #5082: Syntax error, found ')' when expecting one of: , ( ::
     &MPI_COMM_WORLD,status,ierr)
--------------------------------^
cmpcomm.F(153): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , :: : )
        call wrf_debug(2,'CMP_INIT: stopped, rcvd ibuffer(1) value '
------------------------------------------------------------------------^
cmpcomm.F(154): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &         //'is not C id: ',ibuffer(1))
---------------^
cmpcomm.F(154): error #5276: Unbalanced parentheses
     &         //'is not C id: ',ibuffer(1))
-------------------------------------------^
cmpcomm.F(158): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
        call wrf_debug(2,'CMP_INIT: stopped, rcvd ibuffer(3) value ',
------------------------------------------------------------------------^
cmpcomm.F(159): error #5276: Unbalanced parentheses
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
--------------------------------------------------------^
cmpcomm.F(159): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
---------^
cmpcomm.F(159): error #5082: Syntax error, found ')' when expecting one of: , <END-OF-STATEMENT> ;
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
--------------------------------------------------------^
cmpcomm.F(159): error #6252: This format specifier is invalid.   [3]
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
-----------------^
cmpcomm.F(159): error #6358: Constants and expressions are invalid in read-only I/O lists.   [' is not ibuffer_size=']
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
--------------------^
cmpcomm.F(159): error #6414: This PARAMETER constant name is invalid in this context.   [IBUFFER_SIZE]
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
--------------------------------------------^
cmpcomm.F(159): error #6358: Constants and expressions are invalid in read-only I/O lists.   [IBUFFER_SIZE]
     &   ibuffer(3),' is not ibuffer_size=',ibuffer_size)
--------------------------------------------^
cmpcomm.F(215): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
            write(message,*) 'CMP_INTRO: to call MPI_SEND ',
------------------------------------------------------------------------^
cmpcomm.F(216): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &      process_rank_local, process_rank_global
------------^
cmpcomm.F(221): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
          write(message,*) 'CMP_INTRO: error in MPI_SEND, process ',
------------------------------------------------------------------------^
cmpcomm.F(222): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &    process_rank_global
----------^
cmpcomm.F(280): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
        write(message,*) 'CMP_INTRO_m: error in MPI_SEND, process ',
------------------------------------------------------------------------^
cmpcomm.F(281): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &  process_rank_global
--------^
cmpcomm.F(311): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
        write(message,*) 'CMP_INTRO_s: error in MPI_RECV ',
------------------------------------------------------------------------^
cmpcomm.F(312): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &           process_rank_local
-----------------^
cmpcomm.f90(944): catastrophic error: Too many errors, exiting
compilation aborted for cmpcomm.f90 (code 1)
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort --version
ifort (IFORT) 17.0.5 20170817
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

 

Could your please share your  f90 file?

0 Kudos
psing51
New Contributor I
975 Views

Juergen R. wrote:

I have no problems in compiling the code with either ifort, nor gfortran, nor gfortran-based mpifort. 

Yes , you are correct. It seems that mpiifort is not recognizing the syntax.

user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpif77 -E -DDM_PARALLEL cmpcomm.F > cmpcomm.f90
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpif77 -c cmpcomm.f90
cmpcomm.f90:39:10:

 !     The corresponding MPI data type variable MPI_kind_alt_REAL is
          1
Warning: Legacy Extension: Blanket SAVE statement at (1) follows previous SAVE statement
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> echo $?
0
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpif90 -E -DDM_PARALLEL cmpcomm.F > cmpcomm.f90
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpif90 -c cmpcomm.f90
cmpcomm.f90:39:10:

 !     The corresponding MPI data type variable MPI_kind_alt_REAL is
          1
Warning: Legacy Extension: Blanket SAVE statement at (1) follows previous SAVE statement
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> echo $?
0
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort -E -DDM_PARALLEL cmpcomm.F > cmpcomm.f90
user@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort -c cmpcomm.f90
cmpcomm.F(148): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , <REAL_KIND_CON> <REAL_CONSTANT> <DBLPRC_CONSTANT> <DBLPRC_KIND_CON> <QUAPRC_CONSTANT> ...
      call MPI_RECV(ibuffer,ibuffer_size,MPI_INTEGER,MPI_ANY_SOURCE,tag,
------------------------------------------------------------------------^
cmpcomm.F(149): error #5276: Unbalanced parentheses
     &MPI_COMM_WORLD,status,ierr)
--------------------------------^
cmpcomm.F(149): error #5082: Syntax error, found '&' when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
     &MPI_COMM_WORLD,status,ierr)
------^
cmpcomm.F(149): error #5082: Syntax error, found ')' when expecting one of: , ( ::

 

UPDATE- 

mpif90/mpif77 is the correct preprocessor.

user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpif90 -E -DDM_PARALLEL cmpcomm.F > cmpcomm.f90
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn> mpiifort -c cmpcomm.f90
user1@machine1:~/MySoftwares/intel/WRF/3.8/WRFV3/external/atm_ocn>

 

 

0 Kudos
mecej4
Honored Contributor III
975 Views

Commands such as "... -E abc.F > pqr.f90" are what are causing your problems. The first file, abc.F, is by convention a fixed form Fortran file with preprocessor directives embedded in it. A preprocessor (or a compiler called with the -E flag) will produce an output file that is also fixed form. However, you are giving that file a ".f90" extension, which is the convention for a free form Fortran source. Thus, you have a file whose content is not in the form that the compiler expects to go with the name.

Use " ... -E abc.F > pqr.f" or use a compiler flag to ignore the file name suffix (.f90) and consider the file as fixed form.

0 Kudos
Reply