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

Converting CVF Common Block includes

smarcher
Beginner
1,344 Views

I am having trouble getting CVF 6.6 code to complile w/o errors. In particular this code has named common blocks that are brought in via include statements. I get a variety of error message types such as:

C:UsersSteveDocumentsVisual Studio 2005ProjectsItrajItrajCONTRL.fi(11) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: // /

C:UsersSteveDocumentsVisual Studio 2005ProjectsItrajItrajCONTRL.fi(12) : Error: Syntax error, found ',' when expecting one of: => = . ( : %

Here is the text in the include:
C:UsersSteveDocumentsVisual Studio 2005ProjectsItrajItrajCONTRL.fi(12) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( * ::     ...

!C

REAL*8 DTF,DTBF,DTRF,TNEXT,DTBUST,DTBUSG,TKINK,SKINK,CKINK,VKINK

REAL*8 GKINK,HKINK,DAZK,RKINK,THKINK,AttTGOConst1,AttTGOConst2

INTEGER ISYS,NLAST,RUNIT,WUNIT,SUNIT,LMODE,FMODE

INTEGER IOUNIT,NOX,MODE,ICTOUT,BUNIT,IDXCD

LOGICAL BBOOUT,VBOOUT,IPOUT,EVENST,REOUT,DMODE,STOUT,REFLY,RREFLY

LOGICAL DEBUG,RVTOUT,BSTOUT,P_Ball,MaRV,RUnitOpen,BUnitOpen

LOGICAL SAVE_IT,UseMaRV,UseCalc_AttChg_Tgo

CHARACTER*512 FNAMES

Character*1 RV_TypeSave

COMMON /CONTRL/ DTF,DTBF,DTRF,TNEXT,DTBUST,DTBUSG,TKINK,SKINK,

1 CKINK,VKINK,GKINK,HKINK,DAZK,RKINK,THKINK,

2 AttTGOConst1,AttTGOConst2,IDXCD,ISYS,NLAST,

3 RUNIT,WUNIT,SUNIT,LMODE,FMODE,IOUNIT,NOX,MODE,

4 ICTOUT,BUNIT,BBOOUT,VBOOUT,IPOUT,EVENST,REOUT,

5 DMODE,STOUT,REFLY,RREFLY,DEBUG,RVTOUT,BSTOUT,

6 P_Ball,MaRV,UseMaRV,UseCalc_AttChg_Tgo,

7 RUnitOpen,BUnitOpen,SAVE_IT,FNAMES(5),

8 RV_TypeSave

!

Any tips?

0 Kudos
10 Replies
anthonyrichards
New Contributor III
1,344 Views

Your long COMMON statement, spread over several lines, has the wrong or no continuation characters!
If you are including it into a free-formatfile with '.f90' extension, you must adda space and
the & character to the end of each line to be continued. You must then remove the '1','2','3' etc
continuation characters at the beginning, as these only work with fixed format files.

If you are including into a fixed format file, then you have to add the leading 6 spaces to all statements,
except the continuation lines, where you should just add 5 spaces so that the '1','2','3' etc are
aligned correctly with column 6. You must also change comment linesbeginning '!' to begin with 'C'.

0 Kudos
Steven_L_Intel1
Employee
1,344 Views
The leading blanks probably disappeared when pasted into the forum post, but otherwise Anthony's comments are on target.

Sometimes I see sources that require the /extend_source option and users forgot to add it. In general, I recommend against coding to non-standard source forms, so either stick to 72 columns or use free-form source.
0 Kudos
smarcher
Beginner
1,344 Views
The file does have the leading blanks (not tabbed) and is being included in a fixed form subroutine.
0 Kudos
Steven_L_Intel1
Employee
1,344 Views
I don't see the required continuation indicators in the continued lines.
0 Kudos
anthonyrichards
New Contributor III
1,344 Views

Weirdly, the continuation characters '1','2','3', etc. appear as faint white when repeated in the copy of the code
displayed in the reply pane, whereas they are absent from the posted code.

If it is a fixed-format file, you still have a couple ofexclamation marks (there is a !C at the start
and a ! at the end.
If you click on the line flagged for the error, it should move the cursor to the offending line of code.
Your longest line appears to be 71 characters (assuming 6 missing blanks at the start), which
is OK, but the length should be double-checked.

0 Kudos
Steven_L_Intel1
Employee
1,344 Views
Ah - they are not absent - just white on white. Drag your mouse along the text to select it and they will be revealed.

Exclamation mark is ok for a comment in fixed-form.
0 Kudos
Steven_L_Intel1
Employee
1,344 Views
If I take your code, paste it into a fixed form source file and make sure everything is in the right column, it compiles fine.

One possibility - I note that this is a .fi file which means an include file. If you INCLUDE this into a free-form source file (.f90 file type) you will get exactly this sort of error.

If this is the problem, there are several options, but it might do well to see just what was done in CVF to make this compile - applying the same "fix" in IVF would work.

1. Surround the INCLUDE line with:
 !DEC$ NOFREEFORM
 INCLUDE 'CONTRL.fi'
 !DEC$ FREEFORM

making sure that the INCLUDE starts in column 6

2. Follow the rules in the Language Reference under source form for writing the include file in a manner valid for both free and fixed source forms

3. Rewrite the include file to free-form and make sure you don't use fixed-form anywhere in the application.
0 Kudos
smarcher
Beginner
1,344 Views
I believe I have found the problem. Another include, resource.fd, (in free form) was beingincluded before the subject file. Apparently, the IVF compiler changes the file form from that of the file that includes the 'Include' (fixed form) to that of the included file and does not change back to the form of the containing file. CVF 6.6 does remember the original form and reverts after the included file EOF. I have modified the resource.fd file and everything compiles w/o error.
0 Kudos
Steven_L_Intel1
Employee
1,344 Views
No, the compiler has no idea what the form of an include file is and there is no "remembering". Perhaps there was an error in the resource.fd?
0 Kudos
smarcher
Beginner
1,344 Views
What i did was replace '!' on the beginning of 3 lines at the beginning of the file with 'C'
0 Kudos
Reply