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

Different runtime behaviour when run inside VS2005 IDE vs outside

Martin__Paul
Neuer Beitragender I
1.009Aufrufe

I have a VS2005 solution comprising multiple Fortran and VC++ projects. When run from inside the IDE (release; no pdbs), the program generates the expected output. When the very same binary is run from outside the IDE the program generates different output. I confirmed that the same dependencies are loaded at runtime (libmmd.dll; libifportmd.dll; libifcoremd.dll; msvcrt.dll; msvcr80.dll), and there appear to be no project settings that would alter runtime behaviour (e.g. working directory is not set in the ide). Interestingly the debug build generates the correct output when run inside and outside the IDE, which points to a debug-release mismatch (perhaps an uninitialised variable). I am unsure quite why running release mode within the IDE apparently mimics the debug behaviour.

I extracted a filemon log from the differing runs and noticed that the (working) version run from within the IDE queries the location of all C++ lib files built by the solution, first in the release directory followed by the debug directory. The debug check is as follows:

43480 12:36:00 devenv.exe:5816 OPEN C:\TFS\Main\Source\Calculation\mysolution\myproject\Debug\ SUCCESS Options: Open Directory Access: 00100001
43481 12:36:00 devenv.exe:5816 DIRECTORY C:\TFS\Main\Source\Calculation\mysolution\myproject\Debug\ SUCCESS FileBothDirectoryInformation: myproject.lib
43482 12:36:00 devenv.exe:5816 CLOSE C:\TFS\Main\Source\Calculation\mysolution\myproject\Debug\ SUCCESS

This may not help identify the cause of the problem since the lib is not referenced elsewhere; I'm not sure why devenv even locates it at runtime.

Any ideas what may be amiss?

Thanks

0 Kudos
4 Antworten
Wendy_Doerner__Intel
Geschätzter Beitragender I
1.009Aufrufe
One step I take in such cases is to make sure the command line compile is using all the switches from the IDE (you can cut and paste these from

Right click on the Project => select Properties => select Fortran => command line window options

One option that can vary results is the gen-interfaces.

You can try to add /nogen-interfaces to the IDE options to see if this makes a difference.

Wendy
Steven_L_Intel1
Mitarbeiter
1.009Aufrufe
Not sure if it's relevant, but note that the working directory when run in VS will be that of the project folder whereas if you just double-click on the EXE, the working directory will be the same one as the EXE. If you have different input files in those folders it can change behavior.
Martin__Paul
Neuer Beitragender I
1.009Aufrufe

Thanks for suggestions. In the end this was tracked down to an uninitialised variable. Outside the IDE the uninitialised value was much larger than that inside (I hadn't realised they use different memory space), whose cumulative effectgenerated noticeably different output. The difference between debug and release IDE output was subtle.

What is your recommended approach for detecting uninitialised variables? I have experimented turning on static verification but the large number of false positives make its output almost impossible to use. The other option, /check:uninit doesn't work with arrays.

Steven_L_Intel1
Mitarbeiter
1.009Aufrufe
Sorry, I don't have additional suggestions for you.
Antworten