문제

I am using Intel's FORTRAN compiler to compile a numerical library. The test case provided errors out within libc.so.6. When I attach Intel's debugger (IDB) the application runs through successfully. How do I debug a bug where the debugger prevents the bug? Note that the same bug arose with gfortran.

I am working within OpenSUSE 11.2 x64.

The error is:

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

도움이 되었습니까?

해결책

The error message is pretty clear to me, you are attempting to access a non-existent element of an array. I suspect that the value -534829264 is either junk when you use an uninitialised variable to identify the element in the array, or the result of an integer arithmetic overflow. Either way you should switch on the compilation flag to force array bounds checking and run some tests. I think the flag for the Intel compiler would be -CB, but check the documentation.

As to why the program apparently runs successfully in the debugger I cannot help much, but perhaps the debugger imposes some default values on variables that the run time system itself doesn't. Or some other factor entirely is responsible.

EDIT:

Doesn't the run-time system tell you what line of code causes the problem ? Some more things to try to diagnose the problem. Use the compiler to warn you of

  • use of variables before they are initialised;
  • integer arithmetic overflow (not sure if the compiler can spot this ?);
  • any forced conversions from one type to another and from one kind to another within the same type.

Also, check that the default integer size is what you expect it to be and, more important, what the rest of the code expects it to be.

다른 팁

Not an expert in the area but couple of things to consider:

1) Is the debugger initialising the variable used as the index to zero first, but the non-debug does not and so the variable starts with a "junk" value (had an old version of Pascal that used to do that).

2) Are you using threading? If so is the debug changing the order of execution so some prep-thread is completing in time.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top