Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
100 Views

format width control not required in ifort?

I am trying to migrate a .FOR file (for practice purposes) to gfortran. This file compiles in my Intel Visual Fortran solution with no issues. However when I compile it in gfortran I get the following error message:

MyFile.FOR:4561:22:

   102     format(A, I)
                      1
Error: Nonnegative width required in format string at (1)

Does ifort simply not require there to be a format width or are there additional ifort options that enable relaxing this requirement? How come the file runs smoothly in ifort but not in gfortran?

0 Kudos
6 Replies
Highlighted
Valued Contributor III
100 Views

compile with standards checking. There are lots of non-standard extensions to the language that different compilers will accept. If you aim for standards compliance such issue then disappear.

0 Kudos
Highlighted
Valued Contributor III
100 Views

...after and initial world of pain that is.... In Ifort you can have standards checking and then on a per file or per project basis have some non-standard warning numbers that you can chose to let the compiler not report.

0 Kudos
Highlighted
Black Belt
100 Views

Fortran 2003 lets you use the I0 format to let the compiler/runtime choose the proper field width. Section 10.6.1.1 of that standard says this about the Iw.m format:

     When w is zero, the processor selects the field width.

0 Kudos
Highlighted
Beginner
100 Views

@mecej4 

I also have format descriptors like '(A2, F)'. I want the processor to also select the number of decimal points after a floating point number in gfortran. Is there an equivalent way to do that also? specifying a format like '(F0.0)' gives a default width but brings the number of decimal places down to zero...

 

0 Kudos
Highlighted
Black Belt
100 Views

The best way to find answers to such questions is to consult the Fortran compiler (IFort, Gfortran, etc., as appropriate) documentation.

An output format specification of F0.d is allowed, and results in d digits after the decimal point, with the output field width chosen by the "processor".

0 Kudos
Highlighted
Black Belt Retired Employee
100 Views

As others have noted, I and F without widths are an extension. Intel Fortran supplies a default width based on the data type of the item being transferred. This is described in the Intel documentation.

0 Kudos