Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

VARIABLE DECLARATION

Guaglardi__Paul
Beginner
98 Views

I am VERY confused.  Brought over a code from CVF.  Made necessary changes to get the code to function in F90.  Code compiles with no errors nor warnings, rebuilt incrementally checking routines all along.  When executing a case in the INTEL FORTRAN it returns essentially the SAME EXACT answer as was achieved in the CVF.  That code was debugged thousands of times and is working logically correctly.

When I went to do a debug session in the INTEL FORTRAN, it behaved WEIRD, jumping around in subroutines AND ,MORE IMPORTANTLY, SHOWING VARIABLES AS UNDEFINED WHEN THEY ARE EXPLICITLY DECLARED AT THE TOP OF THE SUBJECT SUBROUTINE.

AND, THEY HAVE BEEN CALCULATED.

And, values that are being passed in are SOMETIMES showing no value as UNDECLARED when they are 100 % declared.

WHAT IS WRONG WITH THIS PLATFORM....OR MY UNDERSTANDING OR OPERATION OF IT?

PLEASE HELP.

THANKS.

0 Kudos
6 Replies
andrew_4619
Honored Contributor I
98 Views

Did you build with optimisation? That totally screws up debugging.

 

 

FortranFan
Honored Contributor II
98 Views

What do you mean by "I went to do a debug session in the INTEL FORTRAN"?  Are you using Visual Studio (VS) for this which is a separate application, an IDE, from Microsoft?  If so, then the chances are the integration of Intel Fortran with VS is amiss in your configuration and you will need to do some 'repair' of your installations.  Look under FAQs: 

https://software.intel.com/en-us/articles/intel-visual-fortran-composer-xe-information-and-frequentl...

and go through articles such as: 

https://software.intel.com/en-us/articles/installing-microsoft-visual-studio-2017-for-use-with-intel...

Steve_Lionel
Black Belt Retired Employee
98 Views

Very likely that this was a build with optimization, as Andrew suggests. I very much doubt it has to do with the installation.

mecej4
Black Belt
98 Views

Declaration and definition are different. In the following program, at Line 5, the integer variable i is undefined. The value of the expression containing it is also undefined, and when the value is assigned to the variable j, j becomes undefined. Both variables are declared as INTEGER at the beginning of the program, but that does not constitute definition.

program xyz
implicit none
integer :: i,j
!
j = i+2
print *,i,j
end program

 

Guaglardi__Paul
Beginner
98 Views

All, just after writing post decided to re-enable "check stack frame" and enable "check array bounds" which automatically disables optimization even if set to "enable".  Had to run out for errand BUT colleague tried it after discussing on the phone and it worked for him, he was having the same issue.  Yes, apparently, OPTIMIZATION does "screw up things" when it comes to debugging.  Probably only use for RELEASE version.  Oh, and by the way, the difference between there and their is known as is the difference between "declaration" and "defined". :)

Steve_Lionel
Black Belt Retired Employee
98 Views

"check stack frame" does disable optimization, "check array bounds" does not.

Reply