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

Continuation lines issue with ifort

kserradell
Beginner
1,264 Views
Hello

I'm porting a code to ifort which is compiling correctly with IBM xlf compiler.

When I compile with ifort I've got problems with this continuation lines:

INTEGER kpdtsf,kpdwet,kpdsno,kpdzor,kpdais,kpdtg3,kpdplr,kpdgla,
& kpdmxi,kpdscv,kpdsmc,kpdoro,kpdmsk,kpdstc,kpdacn,kpdveg,
& kpdvet,kpdsot


& is in the beggining of the line, and ifort throws a syntax error.

The workaround is to manually insert & at the end of the line, like this

INTEGER kpdtsf,kpdwet,kpdsno,kpdzor,kpdais,kpdtg3,kpdplr,kpdgla, &
& kpdmxi,kpdscv,kpdsmc,kpdoro,kpdmsk,kpdstc,kpdacn,kpdveg, &
& kpdvet,kpdsot


But there are thousands of code lines (also doing with sed is quite difficult beacuse there are comments and other stuff...).

Is there any compilation flag to compile this syntax ? Or another workaround ?

Thank you very much,

Kim
0 Kudos
1 Solution
Kevin_D_Intel
Employee
1,264 Views

Is your source Fixed or Free format?

I can't tell from the code snippet in your post if some additional indentation was lost but the line continuation shown hints the source may be Fixed format and if so and those lines cause compile errors then that, and your work around, suggests the source was compiled as Free format by ifort. Unless overridden by a compiler option or directive, the source file suffix determines the source form applied at compilation.

If you use a Free form file suffix (.f90, .F90) but the source is Fixed form, thenyou can set the source format to Fixed with the compiler option: -fixed

Or use a file suffix that implies Fixed form, e.g. .f, .for, .FOR, .ftn, .FTN

View solution in original post

0 Kudos
4 Replies
Kevin_D_Intel
Employee
1,265 Views

Is your source Fixed or Free format?

I can't tell from the code snippet in your post if some additional indentation was lost but the line continuation shown hints the source may be Fixed format and if so and those lines cause compile errors then that, and your work around, suggests the source was compiled as Free format by ifort. Unless overridden by a compiler option or directive, the source file suffix determines the source form applied at compilation.

If you use a Free form file suffix (.f90, .F90) but the source is Fixed form, thenyou can set the source format to Fixed with the compiler option: -fixed

Or use a file suffix that implies Fixed form, e.g. .f, .for, .FOR, .ftn, .FTN

0 Kudos
kserradell
Beginner
1,264 Views
Thank you Kevin !!!

It was this !!! I building a code that is quite a mess and there free and fixed forms mixed.

Thank you again !!!

KiM
0 Kudos
mecej4
Honored Contributor III
1,264 Views
In the few original lines that were shown, the character '&' is preceded by five blanks, suggesting that the source is in fixed format. If this description applies to the entire code, all that you have to do is to follow the suggestions of Kevin Davis. My preference would be to use the file suffix '.f'.
0 Kudos
Kevin_D_Intel
Employee
1,264 Views
You're welcome, Kim. Glad that helped.
0 Kudos
Reply