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

array bound error checking question

Brian_Murphy
New Contributor II
793 Views

I am debugging a console application.
I have the Fortran/Run time/Check array bounds and strings turned ON.
I have the Fortran/Run time/Generate Tracebacks turned ON.
In the debugger, the code breaks and I get a message that array bounds have been overstepped, but I don't get the line number and name of offending routine.

Is there something else that should be turned on?

Thanks,

Brian
Austin, TX

 

0 Kudos
19 Replies
lklawrie
Beginner
793 Views

Do you have DEBUG turned on in the linker?

0 Kudos
Steven_L_Intel1
Employee
793 Views

Look for the console window, which is probably hiding "behind" the debugger window. Although, as Linda suggests, if you're running in the debugger, click Break when the message appears and you'll be taken to the line where the error occurred.

0 Kudos
Brian_Murphy
New Contributor II
793 Views

I think so.
Generate Debug Info is Yes
Generate Program Database File is set to a pdb file
Generate Map file is NO
Map Exports is NO
Debuggable Assembly is NO Debuggable attr. emmitted

Is there an easy way to paste into a forum post a screen capture image?

0 Kudos
jimdempseyatthecove
Honored Contributor III
793 Views

Right click on consol window title bar. Select "Select All" and press Enter to copy all of console windoe to paste buffer, or Select "Mark", mark with mouse, press Enter to copy to selected text paste buffer. Then in the forum edit box for messages:

{left square bracket}bash{right square bracket}
(Ctrl-V to paste)
{left square bracket}/bash{right square bracket}

You can try {left square bracket}plain{right square bracket}
(paste)
{left square bracket}/plain{right square bracket}

but that may use variable pitch font. bash is fixed pitch.

When pasting one of the supported language code snips use those.

Only use screen shots when no other option is available.

Jim Dempsey

0 Kudos
Brian_Murphy
New Contributor II
793 Views

I am running in the VS2012 debugger.
When the code runs VS displays a message "mycode.exe has triggered a breakpoint.
In the console window I see the message about the array bounds problem that names the offending array but not the routine and line number.
I pressed control-break on the keyboard but that didn't do anything.

Thanks,

Brian

 

0 Kudos
Brian_Murphy
New Contributor II
793 Views

I was trying paste in a screen capture of part of the Project Options/Linker/Debugging window.  Since I couldn't do that, I typed some of the setting directly into the post.

0 Kudos
jimdempseyatthecove
Honored Contributor III
793 Views

The message box should also have information as to what to press to enter debugging. (usually Continue)

Jim Dempsey

0 Kudos
Brian_Murphy
New Contributor II
793 Views

I clicked the "break" button, and that brings on a "no source available" window and I can't find the line of my program where the break occured.  That is the heart of my problem.  If instead click "continue" this stops the debugger and closes the console window.

0 Kudos
Steven_L_Intel1
Employee
793 Views

First, look for the console window in your taskbar tray. This will have both the error message and the traceback. It sounds to me as if you enabled bounds checking and traceback for a Release configuration - is that true? You'll also need to make sure that Linker > Enable Incremental Linking is set to "No".

0 Kudos
Brian_Murphy
New Contributor II
793 Views

forrtl: severe (408): fort: (3): Subscript #1 of the array PM_RATIO has value -1  which is less than the lower bound of 0

Other than the program's own writing to the console window, the above is what shows up.  There is nothing else.  If I can't get the traceback info, my only recourse is to go digging through mountains of code looking for the place where that particular array is going out of bounds.  After this one there's likely to be more.

0 Kudos
lklawrie
Beginner
793 Views

If you are in a release configuration, you also have to turn on debugging in the Linker section.  As I indicated before.

Not sure how it is in VS2012 - Properties - Linker - Debug.

0 Kudos
Brian_Murphy
New Contributor II
793 Views

I forgot to say that, yes, I am debugging with the debug configuration as the "active" configuration.  This is VS2012 and IVF Composer XE 2013.

I should point out that after I execute the code enough times, I suspect that VS may become unstable such that it won't build the project after I make a code change.  Restarting VS gets it working again.

Brian

0 Kudos
Brian_Murphy
New Contributor II
793 Views

There are times when all I get is the following in the console window:

forrtl: severe (179): Cannot allocate array - overflow on array size calculation . Image              PC        Routine            Line        Source libifcoremdd.dll   002AFA8A  Unknown               Unknown  Unknown

This doesn't give me much to go on.  This ought to be from doing an ALLOCATE with invalid sizes.  How do I get Intel Fortran to tell me where the problem is occurring?

0 Kudos
Lorri_M_Intel
Employee
793 Views

Ok, two suggestions.   When you get the "break", can you check the CallStack window?  The actual "breakpoint" is happening in the Fortran run-time code, but that, of course, is called from your code.  Can you see any of your routines in the call stack?

The other suggestion is slightly off-the-wall, but is there *any* chance that you have the environment variable FOR_DISABLE_STACK_TRACE set?   That does just what it sounds like, and disables the lengthy stack trace.

                         --Lorri

 

0 Kudos
Brian_Murphy
New Contributor II
793 Views

In the call stack window I see the normal stuff until the break happens, then all that is there is:

> libifcoremdd.dll!<Unknown function> Unknown   
[Frames below may be incorrect and/or missing, no symbols loaded for libifcoremdd.dll]    
libifcoremdd.dll!<Unknown function> Unknown   
libifcoremdd.dll!<Unknown function> Unknown

How do I check the environment variable? I opend a command promptt window and typed SET and I see several Intel Fortran items and several IMSL items, but not the one you named.

Something must be really messed up.  It shouldn't be so hard to get the fortran program to tell me what line is causing the error.  Is there anything else that might need to be turned ON or turned OFF to get this? Is this a Visual Studio problem or an Intel Fortran problem?  I have no clue?

0 Kudos
Steven_L_Intel1
Employee
793 Views

It could be that your program has corrupted the stack - this could trigger such errors and also interfere with traceback.  Try a simple program in a new project that deliberately gets an array bounds error and you'll see what it should look like.

0 Kudos
Brian_Murphy
New Contributor II
793 Views
Hmmm! Can you give me an example of how the "stack" can get corrupted? I am finding that this code is executing a lot of array allocation statements and array copying statements for things that should be skipped. Like when the current case being run doesn't have any Widgets, but the code is trying to allocate array space for and assemble zero Widgets. This code ran ok in IVF 10.x when compiled by someone else. I am compiling the code with IVF Composer XE2013 and I'm encountering lots of problems. I am running very "small" cases, so I should be nowhere close to running out of memory.
0 Kudos
Steven_L_Intel1
Employee
793 Views

Writing outside the bounds of an array, mismatched routine arguments, incorrect use of pointers, calling STDCALL routines with the C convention and vice-versa. Have you tried turning on the Run-time > Check stack frame option?

0 Kudos
Brian_Murphy
New Contributor II
793 Views
I didn't know about that option, and it was indeed turned off. I changed Runtime Error Checking from Custom to ALL, and after rebuilding, the debugger now seems to break at the offending line. Hurray! Time to roll up my sleeves and get to work. Thanks bunches for the help. I hope I retire before you do, Steve. (have I said that before?).
0 Kudos
Reply