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.
29284 Discussions

Program works compiled with -g but not when optimized.

rajesh_dorai
Beginner
682 Views
Greetings!

I have a Fortran program which works well when compiled on Windows (using Compaq Visual Fortran compiler) and UNIX (f77 compiler). It works fine when I compile with ifort using the debug option. When I use the default compile (using -c to create .o and then link) or use optimization flags (-On, n=1,2,3), the code crashes with the following output:

forrtl: severe (64): input conversion error, unit 70, file /icp.pdt
Image PC Routine Line Source
hpemifort.exe 081B5519 Unknown Unknown Unknown
...
...
...
...

Stack trace terminated abnormally.


The file is UNFORMATTED. On doing a web search, I find that this could be a problem with the code writing to and reading from UNFORMATTED files. However, I am not sure why it works fine with the debug option and not when optimized.

Any help would be greatly appreciated.

Thanks,
Rajesh.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
682 Views
The error message relates to a formatted (or list-directed) input error, not unformatted. This is the sort of problem that is nearly impossible to diagnose from a description. One would have to analyze the program to see what is going wrong.
Please make sure you are using the latest ifort. If the problem persists, submit a reproducible and buildableexample to Intel support.
0 Kudos
rajesh_dorai
Beginner
682 Views
On doing further experiments with the compiler options, I found out that this is a problem with floating point operations. When I compile with "-c -mp", the program runs fine.

I am also able to run with higher optimizations (O3). I was however surprised when the code took a significatly longer time to run when compiled with "-c -mp1" (about an order of magnitude longer time).

I also did another experiment by compiling the code in Windows using Compaq Visual Fortran. This time I set the flag "Floating Point Underflow" to ON. Sure enough, there was a run time error.

On the whole, the problem was with floating point operations and was got around by using the -mp option.
0 Kudos
Reply