Error - closes program and returns to Visual Studio

Error - closes program and returns to Visual Studio

I am running a complex program and I'm getting an error - the program just closes. The program normally works but in this case it is using more data than normal. 

I thought if I run it within Visual Studio I would at least see which line is causing the problem.

But the program just closes and returns to Visual Studio.

Do you have any suggestions on how track down the error?

Thanks

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I assume that if you select "Debug->Start without debugging" that you see some sort of error in the command window.

Given that, please try going to Debug->Exceptions and configure your session to break at all the exceptions, and then re-try debugging your program.

Does it stop this time?

                   --Lorri

Thanks,

I had used Debug - Start Debugging.

I have tried Debug - Start without debugging.

In both cases I don't get any error in the command window.

In the Debug menu I don't have the choice 'Break on Exceptions', am I looking in the wrong place?  

What version of Visual Studio are you using?

And, did you build your program within Visual Studio or did you build it outside, and then try to run it within Visual Studio?  I had assumed the former, but maybe that was a bad assumption?

 

It is Visual Studio 2010.

I built the program within Visual Studio.

As I said the program normally runs bur in this case there is a lot of data. I had expected it to fall over on say the size of an array not being big enough - stopping on the specific line - but it comes out of the program completely without an error being displayed. 

You may need to resort to some dumb bug hunting.

Is there a loop within the code? If so then print out the loop counter. Then when the program "stops", the value of the counter should be shown in the output window. You could then put a conditional break point within the loop to break when the counter reaches that value then step through the code until you see why it stops.

If it reads data from a file you could try printing something after the read to identify which was the current record being processed at the time it stopped. Again you would put a conditional break point after the read, and step through the code from then on.

If neither are applicable you may just have to add print statements at various crucial points of the code to identify at what point the stop happened.

You could also try putting a break point at or near the end of the main program - assuming that is where it ends up just before it stops. Then you could examine the contents of the variables - trying to determine just how far it got through processing the data.

Hopefully something along the lines of the above will help narrow down the problem.

Les

Cases I have seen when a program just exits silently are usually caused by either stack corruption or coming too close to static memory size limits. Are you using allocatable arrays for your large data?

Steve - Intel Developer Support

Do you have a main program?

Do you know where the first executable statement in this program is?

If yes to both the questions, what happens if you place a breakpoint at the first executable statement and run your program in the debugger?  Does it reach that statement?  If yes, can you step through your code beyond that and see where your program exits?

I found the error was caused by

read (63,rec=r) i4

where r was a negative number. I was using a temporary file: open (63,STATUS='scratch',access='direct',form='binary',recl=8)

Why r is negative will take more investigation.

Where is this temporary file located? 

 

 

In the folder pointed to by the TEMP environment variable. Interesting - I will check into that. Thanks!

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today