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

Illegal Character in columns 1-7

dobrien
Beginner
447 Views

Is there a way to compile this program?

PROGRAM HELLO
WRITE(*,1)
1 FORMAT('Hello World')
END

ifort doesn't like the FOR in columns 4,5,and 6. I have some source (hundreds of files) that is fixed format but labelled lines like format and continue don't start in column 7.

Illegal character in statement label field is the error the compiler gives.

Thanks.

0 Kudos
2 Replies
Bonnie_A_Intel
Employee
447 Views

By default, the format (fixed or free format) is determined by the Fortran file extension. Files with an extension of .f90, .F90, or .i90 are free-format source files. Files with an extension of .f, .for, .FOR, .ftn, .FTN, .fpp, .FPP, or .i are fixed-format files. You can also compile with the -free option to specify to the compiler that source files are in free format, or the -fixed option to specify that the source files are in fixed format.

I created a little test.f90 file with your code and compiled it with just "ifort" which defaults to free format because of the .f90 file extension. So depending on your file extension(s) you may need to compile some or all of them with the -free switch.

0 Kudos
Steven_L_Intel1
Employee
447 Views
See also this duplicate thread.
0 Kudos
Reply