2

I'm using Intel Fortran Compiler 15.0 within the Visual Studio 2013 environment. I'm new of those softwares and I'm not a programmer, but just an engineer using fortran to do some computation, thus, please, try to reply with an "easy" language.

The problem is this: I'm in the debug mode and I compile and execute the program within visual studio just pressing "start debug". Everything goes fine and I get what I expect, still the code run slow. Now if I go to the folder .\x64\Debug and run the program from the executable file, it gives different results (and at certain points stops due to unrealistic results). What is happening? I have no idea of how to fix it. Why is it working fine within visual studio and crashes if run from the executable file? The executable file created in Release mode gives the same problem.

Any help will be appreciated, thanks a lot, Antonio

SOLUTION: I found out that the problem was in the allocation and initialization of a logical variable. In the first place I had just allocated the variable and I could see its value was .TRUE. after the allocation, during debugging. Unfortunately, the allocation seems to work differently if run directly from the executable file outside VS or within VS. Adding "_NO_DEBUG_HEAP=1" to the environment causes the behavior of the program to be the same inside and outside VS, thus I could debug the code and I noticed that after the allocation the value was .FALSE.. The problem was solved inserting a line just after the allocate() command that initialize always the logical variable to .TRUE.. Now I get the same results both inside and outside VS. This post helped a lot Differences between running an executable with Visual Studio debugger vs without debugger

Thanks, Antonio

Community
  • 1
  • 1
  • Does the program read some of its input from files? Is it reading the same set of files with the two different methods of starting it (the current directory for the program may be different between the two methods). Beyond wild guesses, to realistically address something like this you are going to have to provide a lot, lot, lot more information, perhaps the entire project. – IanH Jun 24 '16 at 00:25
  • Dear @IanH, thanks for your answer. I found what makes the difference (still I haven't solved the problem), but, as I said, I'm not an expert, and it would be nice if someone helps me to understand a bit more what is going on. The code crashes at the same point within VS or from the executable if I set in Properties/Debugging/Environment "_NO_DEBUG_HEAP=1". Do you have a clue of what should I seek in the code? It seems a problem of initialization of heap arrays... – Antonio Papangelo Jun 24 '16 at 07:31

0 Answers0