Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

write problem

senji
Beginner
472 Views

The following line of code screw up my StandardOutput:

write(*, '(a)') i, 'Test123'

The reason is that "i" is an integer which does not appear in the format descriptor.

With the correct Format string '(i,a)' the StandardOutput works like a charm.

I'm using IVF 11.0.072 in Visual Studio 2005 SP1.

Now my question :-)

Is it possible to check the source code for such problems with a compiler setting, warning level or

something like that ?

thx in advance,

senji

0 Kudos
1 Reply
mecej4
Honored Contributor III
472 Views
Most Fortran compilers do not check the compatibility of format strings against the items in the I/O list at compile time. This is run by the I/O runtime, and you may get an execution error. Consider why this checking is difficult to do: an I/O list with an implied DO loop or an array item expands to a number of items that is not known at compile time. While your simple case is easy to diagnose at compile time, the compiler writer has to either do the checking adequately for all cases, or not at all. Doing only the easy cases is not acceptable, because users will not know when a missing error message is caused by (i) there being no error or (ii) the compiler not being smart enough to spot the error.

With g95, for example, your program generates the runtime error:

"Fortran runtime error: Expected CHARACTER for item 1 in formatted transfer, got INTEGER."


0 Kudos
Reply