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

How to step through hello world program

awa5114
Beginner
1,131 Views

I cannot step through this program in peace:

program main
    print *, "Hello world"
end program main

The very last line is problematic. Any combination of "Step Into", "Step Over" and "Step Out" does not do the trick. Stepping over "END PROGRAM MAIN" opens up the window (see attachemnt).. with the following message

Source Not Available

Source Information is missing from the debug information for this module

You can view disassembly in the dissassembly window. To always view disassembly for missing source files, change the setting in the options dialog.

This is not OK that Intel Visual Fortran does not allow me to step through such a simple program! Why is this happening and how can I fix it?

 

0 Kudos
8 Replies
IanH
Honored Contributor II
1,131 Views

You have stepped off the end of your fortran program and back into one of the several layers of program setup and tear down code.  You don't have the source for that code, hence the messages.  Why do you want to debug that setup and tear down code?

0 Kudos
awa5114
Beginner
1,131 Views

Every other IDE I know allows the user to step through code to completion. Including Visual Studio with other languages like C. It's weird that Intel fortran involves the user with the "tearing down of the code". 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,131 Views

You can step through the code to completion...
however, that code does not include the debug information (nor source files)...
ergo this leaves you with stepping through is disassembly mode.

Jim Dempsey

0 Kudos
mecej4
Honored Contributor III
1,131 Views

Amine A. wrote:
Every other IDE I know allows the user to step through code to completion. Including Visual Studio with other languages like C. It's weird that Intel fortran involves the user with the "tearing down of the code". 

Not so weird if you recognize that Fortran is a red-haired step-child in a swarm of C-ish siblings. Every Fortran program EXE with Intel Fortran contains the C CRT, which calls the C main entry main_, which in turn calls the Fortran entry MAIN__, From the point of view of the C main_, the Fortran code is simply another C-ish "function". Correspondingly, after the Fortran program finishes, there is clean up (tear-down) to do before control goes back to C, and more clean up to do before going back to the OS.

If Intel provided their own independent and self-contained debugger (which, in fact, they did for a few years), some of these transitions could be kept opaque.

I think that there is a VS setting that prevents it from showing disassembly when source code is not available. Just set that.

0 Kudos
FortranFan
Honored Contributor II
1,131 Views

Amine A. wrote:

I cannot step through this program in peace:.. Why is this happening and how can I fix it?

Yes, for the sake of peace everywhere, please add first the IMPLICIT NONE statement, a must for 'peace', and then the STOP statement which allows Intel Fortran integration in Visual Studio to inform the debugger to complete the execution termination process without trying to debug the disassembly..

program main
   implicit none
   print *, "Hello World!"
   stop
end program main

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,131 Views

FortranFan... then the OP might wish to step into the STOP... to see what it does.

Jim Dempsey

0 Kudos
mecej4
Honored Contributor III
1,131 Views

jimdempseyatthecove wrote:

FortranFan... then the OP might wish to step into the STOP... to see what it does.

In that case, VS could be set up to show something similar to https://thumbs.dreamstime.com/z/red-railroad-buffer-end-to-destination-49377747.jpg instead of displaying disassembly of the clean-up code.

0 Kudos
FortranFan
Honored Contributor II
1,131 Views

jimdempseyatthecove wrote:

FortranFan... then the OP might wish to step into the STOP... to see what it does.

Jim Dempsey

Indeed, that is why peace is most elusive!

0 Kudos
Reply