连接调试器时不会出现的错误
我正在使用英特尔的 FORTRAN 编译器来编译数值库。测试用例在 libc.so.6 中提供了错误。当我连接英特尔的调试器(IDB)时,应用程序成功运行。如何在调试器阻止错误的情况下调试该错误?请注意,gfortran 也出现了同样的错误。
我正在 OpenSUSE 11.2 x64 中工作。
错误为:
forrtl: strict (408): fort: (3): 数组 B 的下标 #1 的值为 -534829264,小于下限 1
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
错误消息对我来说非常清楚,您正在尝试访问数组中不存在的元素。我怀疑当您使用未初始化的变量来标识数组中的元素时,值 -534829264 是垃圾,或者是整数算术溢出的结果。无论哪种方式,您都应该打开编译标志以强制进行数组边界检查并运行一些测试。我认为英特尔编译器的标志是
-CB
,但请检查文档。至于为什么程序显然在调试器中成功运行,我无能为力,但也许调试器对运行时系统本身没有的变量强加了一些默认值。或者完全是其他一些因素造成的。
编辑:
运行时系统没有告诉您哪一行代码导致了问题吗?还有一些事情可以尝试诊断问题。 警告您
另外,检查默认整数大小是否符合您的预期,更重要的是,检查其余代码的预期。
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
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.
不是该领域的专家,但需要考虑以下几点:
1)调试器是否首先将用作索引的变量初始化为零,但非调试器不会,因此该变量以“垃圾”值开头(有一个旧版本的 Pascal 曾经这样做过)。
2)你使用线程吗?如果是这样,调试会更改执行顺序,以便某些准备线程及时完成。
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.