- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am using Parallel Studio XE2015 to compile a program that was compiled with Visual Fortran in the past. It looks like the compiler is ignoring !DIR$ and cDEC$ compiler directives. Initially, I thought cDEC$ had been deprecated, but !DIR$ is also being ignored. Do I need a special compilation switch? The program uses mostly fixed-form 72-column code, but it uses longer fixed-form code and freeform code in a few places, and I need the directives for this purpose.
BTW, I have enabled the pre-processor (/fpp); does it interfere with these directives?
Any suggestions?
Thanks,
Gabriel
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cdec$ wouldn't work in free form source context, but none of your other suggestions would account for not recognizing directives. Setting -fpp would activate cpp style directives which might be set to "comment out" some code including directives.
We may need a specific example to discuss further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Test case, please. !DEC$ and !DIR$ directives are always recognized.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim and Steve,
Thanks for your responses. I tested the code below with and without /fpp. It compiles OK without /fpp, but it gives me a syntax error if I use /fpp. I am using the 2015 version of the product (update 4).
Thanks,
Gabriel
code:
c !DIR$ FIXEDFORMLINESIZE: 132 WRITE(NWR1,'(A)') .'$Id: xxxxxxxxxxxxx.f,v 2.5.1.83 2015/07/31 21:56:19 Gabriel Exp Gabriel $' !DIR$ FIXEDFORMLINESIZE: 72 C' end
error:
Error 2 error #5082: Syntax error, found REAL_CONSTANT '.5' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; . % (/ + - [ : ] /) . ** / // ... C:\.................\Source1.f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One more thing: the source code with the problem is in unix-style (lines ending in LF) *.f files. I tried converting the test above to CR LF ending, and the problem remains.
Thanks,
Gabriel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FPP doesn't recognize FIXEDFORMLINESIZE.and I don't think it ever has. You could write this as a concatenation of two character literals split onto separate lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
This program has both fpp directives and cDEC$ directives. If I compile with /fpp, then the cDEC$ (or !DIR$) directives get ignored. This is my problem (the 4 lines in the example was the easiest chunk of code I could find for a test, NOT the main issue).
If I disable fpp, then the cDEC$ lines are interpreted OK, but lines such as
#ifdef revert
produce the error message: Warning 4 warning #5117: Bad # preprocessor line C:\......\myprogram.f 3431
Under CVF, you could have both. AFAIK, the IVF documentation does not say anything about the two being incompatible.
Thanks,
Gabriel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The CVF fpp was a different implementation. My advice is to rewrite the code to not depend on nonstandard directives, especially those that modify the source form..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The reason that /fpp seems to make things break is that /fpp causes the C-style preprocessor to be run first. If you run with /fpp /E, you can see the preprocessed source become
# 1 "gab.f" c !DIR$ FIXEDFORMLINESIZE: 132 WRITE(NWR1,'(A)') .'$Id: xxxxxxxxxxxxx.f,v 2.5.1.83 2015/07/31 21:56:19 Gabriel Exp G !DIR$ FIXEDFORMLINESIZE: 72 C' end
As you can see, the long line has already been wrapped before the preprocessed source is handed to the pass of the Fortran compiler that processes the !DIR directives. In other words, the damage has been done before the directive is recognized and acted upon.
If you use the option /4L132 or /extend-source, things work correctly.
For the record and for what it is worth, the following is what the CVF 6.6C compiler run with /fpp said:
s:\lang>df /fpp gab.f Compaq Visual Fortran Optimizing Compiler Version 6.6 (Update C) Copyright 2003 Compaq Computer Corp. All rights reserved. Compaq (R) Fortran Preprocessor Version 6.6-25 Copyright 2001 Compaq Computer Corporation. gab.i gab.f(4) : Error: Syntax error, found ''' when expecting one of: ( , <END-OF-STATEMENT> ; <IDENTIFIER> <CHAR_C ON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> ... .'$Id: xxxxxxxxxxxxx.f,v 2.5.1.83 2015/07/31 21:56:19 Gabriel Exp Gabriel $' ------^ gab.f(4) : Error: Syntax error, found REAL_CONSTANT '.5' when expecting one of: ( * :: , <END-OF-STATEMENT> ; : ) + . - % (/ [ ] /) . ** / > ... .'$Id: xxxxxxxxxxxxx.f,v 2.5.1.83 2015/07/31 21:56:19 Gabriel Exp Gabriel $' -------------------------------^
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Again Steve (and others who responded).
So, the bottom line is that fpp directives and !DIR$ directives cannot be mixed. Right?
If this is the case, my only option is to convert the fpp instructions (which select alternative portions of the code using #IFDEF) to the corresponding !DIR$ directives (moving further away from standard code). Annoying but not too bad. This program has directives to change the source-code format in certain segments* (using cDEC$) and directives to choose alternative code (using fpp).
The program used to compile under CVF with fpp (I just checked the old dsp file). The reason mecej4 got error messages is that I changed cDEC$ to !DIR$ from the original code.
Thanks,
Gabriel
*Footnote: I know the code segment I used to reproduce the problem is trivial, but there are more complicated ones elsewhere in the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If this is the case, my only option is to convert the fpp instructions.
Is there a reason for not using /extend-source, which makes your directives work even with /fpp ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4,
Thanks for your suggestion. /extend-source takes care of the problem FOR THAT LINE OF CODE. The code snippet compiles whether the !DIR directives are interpreted or not (it does not necessarily mean that fpp is working). The problem occurs elsewhere in a large program, where I have some FREEFORM code embedded within some FIXEDFORM code in a file with the .f extension, in addition to other portions of the code where I have conditional code controlled by #IFDEF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Gabriel Toro wrote:
So, the bottom line is that fpp directives and !DIR$ directives cannot be mixed. Right?
No. Most !DIR$ directives are fine. The ones that will give you trouble are those that change how the source line is parsed, such as switching between fixed and free form source, or changing the fixed form line size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve. Unfortunately, the !DIR$ directives this program uses are exactly the ones that cannot be used.
I would characterize the behavior you describe as a bug, not a "feature".
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page