- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was given a bunch of Fortran code that compiles in windows using Wendy Fortran compiler and told to compile it for Linux.
Some of the files seem to compile just fine, but the Intel compiler seems to choke on some of the line continuations.
As a disclamer: I don't speak fortran so my understanding of what is going wrong could be off.
I use the following command to compile:
ifort -c -extend-source 132 -vms DRAW.FOR
The first errors Iget are:
DRAW.FOR(57): error #5078: Unrecognized token '&' skipped
1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X,&
-------------------------------------------------------------------------------------------------------------^
DRAW.FOR(57): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of:
1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X,&
--------------------------------------------------------------------------------------------------------------^
DRAW.FOR(59): error #5276: Unbalanced parentheses
*X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
-----------------------------------------------------------------^
DRAW.FOR(58): error #5082: Syntax error, found '&' when expecting one of:
& 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD,IMP
------^
The lines of code that this correspond to are as follows (the columns may not line up properly in the pasted text, but they are correct in the code file):
1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X,&
& 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD,IMP
*X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
Is there a compiler flag that I'm missing to tell it to recognize the continuation characters? Any other suggestions as to how to make it work?
Thanks, Bryan
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want, you can try to see if the file compiles using free-format rules, by using the compiler switch -free.
If that does not work, you have to fix your source code and ensure that it adheres to one of the two standard-specified source formats, rather than a mix of the two.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-free option in place of extend-source may work better. -free is implied default for .f90 source file names.
It's strange to use f90 source code format with syntax which was obsoleted in F77, so I'm concerned you may need luck and persistence, including checking documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X,
* 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD,IMP
*X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
gives the errors:
DRAW.FOR(59): error #6186: This character is not valid in a format list.
*X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
DRAW.FOR(59): error #7421: A constant or general expression must appear in a format list in this context. [X,NOEJ/]
*X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
DRAW.FOR(59): error #6186: This character is not valid in a format list.
*X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
Does it not like the fact that the line was broken inside the 68H descriptor block?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, there was no standard which strictly supported both f66 Hollerith and apostrophe quoted strings in the same format, although there aren't so many reasonable variations in intepreting that. If you intend to make this work reliably, you may have to clean it up to correspond with F77.
If you do have a separate item X in a format list, that was an extension used by some compilers as a synonym for 1X, which F90 compilers are obliged to have a means to flag as non-standard (a common means being to reject it).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe that the X in the line was supposed to be a part of the previous word before the end of the line was reached, makeingthe wordIMPX.
I get a similar error if I change the lines to:
1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X,
* 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD,
*IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
results in the following:
DRAW.FOR(59): error #6186: This character is not valid in a format list.
*IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
DRAW.FOR(59): error #7421: A constant or general expression must appear in a format list in this context. [IMPX,NOEJ/]
*IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
DRAW.FOR(59): error #6186: This character is not valid in a format list.
*IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
DRAW.FOR(59): error #6186: This character is not valid in a format list.
*IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
------^
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See the compiler options -nopad-source and -pad-source. If -nopad-source is in effect, the presence of trailing blanks in your source lines can cause errors.
A better long-term solution is to use one of the many utilities available to convert the Hollerith strings to quote-delimited strings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following may or may not be formatted correctly
1 2 3 4 5 6 7
123456789012345678901234567890123456789012345678901234567890123456789012
1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X,
1 2 3 4 5 6 7
123456789012345678901234567890123456789012345678901234567890123456789012
* 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD,
12345678901234567890123456789012345678901234567890123456789012
(1st 62 chars of 68)
*IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3)
345678^^^
(last 6) |-- OEJ is additional text
*** copy the above and paste into a text editor using fixed font (Courier)
Note, the OEJ follows the text of the 68Hconstant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fxfortran] 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012 1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X, 1 2 3 4 5 6 7 123456789012345678901234567890123456789012345678901234567890123456789012 * 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD, 12345678901234567890123456789012345678901234567890123456789012 (1st 62 chars of 68) *IMPX,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3) 345678^^^ (last 6) |-- OEJ is additional text
That works
The code I copied from the original poster had FORMAT comminng on on column 6.
I left that were it was, as well as the original lead-in spaces. These may or may not
be what was in the original souce
Thanks for the tip
Jim[/fxfortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[fxfortran] 1 1 1 1 1 1 1 123456789012345678901234567890123456789012345678901234567890123456789012 1003 FORMAT(25H0OPTIONS NOW IN EFFECT...//5X,12HEXT,INT,TYPE 3I3/5X, * 68HHID,CENT,CART,PERS,SUBS,XSEC,EXPL,AXES,DOTS,LABL,MSKI,MSKD,IMP 12345678901234567890123456789012345678901234567890123456789012 *X,NOEJ/5X,2L3,12L5/5X,'FRG BRD',/,5X,2L3) 345678 [/fxfortran]
Neat trick with the insert code tool. I didn't know about it either, which is why my FORMAT didn't line up in the right place. Above is the original code with everything lined up as it should be, and numbers thrown in to verify the correct columns.
My original problem still exists, the compiler doesn't like it when I break a line inside a Hollerith string and continue it on the next line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't see your column 1 or '1' got dropped from line 2
When I did a reply to this post, momentarily I could see the 1 on the 1234... line 2, (prior to doing the listing format change).
----
I suppose your current fix would be to change the 68H to 62H, then on the following line
* 6HX,NOEJ/5x,....
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An important point to remember is that the standard assumes all fixed-form source lines are exactly 72 characters long. What compilers do with shorter lines is implementation-dependent. By default, Intel Fortran stops at the end of the source line, but if you add the -pad-source option, lines are padded to 72 (or 80 or 132 if you've extended the source line length.) For continued lines, the statement picks up in column 7 or after the continuation indicator in tab source form.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page