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

Run with wrong order

GHui
Novice
306 Views
My program compiled with ifort 12.1.0 on el6.2, and parameter O3. I traced it with gdb, it seemed run wrong order(It run 10 line, then 8 line, and then 10 line. According code, it will first run 8 line, and then 10 line.). And there are more like this. How can I resolve these porblems step by step?
Any help will be appreciate.
-GHui
0 Kudos
1 Reply
Anonymous66
Valued Contributor I
306 Views

The option -O3 turns on high level optimizations. As a part of the optimization process, the compiler may change the order of execution within your program if it will speed up the program without changing the results.

Optimization is turned off by default if you use the debugging option -g. It can also be turned off by the option -O0. Unless you are debugging an optimization related issue, I would recommend debugging with optimization turned off. Without optimization, the lines will execute in the expected order.

0 Kudos
Reply