Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intel Fortran -- -check bounds doesn't give line number

I'm using the intel fortran compiler (ifort) in an mpi environment. It turns out that my code has a buffer overflow as I compiled with the flags -g -O2 -check bounds. After running a while, I get this message:

forrtl: severe (408): fort: (2): Subscript #1 of the array XX has value 4 which is greater than the upper bound of 3

Image            PC                Routine            Line        Source             
program.exe      00000000006E757E  Unknown               Unknown  Unknown
program.exe      00000000006E6016  Unknown               Unknown  Unknown
program.exe      00000000006905B2  Unknown               Unknown  Unknown
program.exe      0000000000642E6B  Unknown               Unknown  Unknown
program.exe      0000000000643381  Unknown               Unknown  Unknown
program.exe      00000000005F33FB  Unknown               Unknown  Unknown
program.exe      00000000004139E7  Unknown               Unknown  Unknown
program.exe      000000000040A6B4  Unknown               Unknown  Unknown
program.exe      0000000000409D2C  Unknown               Unknown  Unknown
libc.so.6        000000380D61ECDD  Unknown               Unknown  Unknown
program.exe      0000000000409C29  Unknown               Unknown  Unknown

This is great -- I now know that I'm overrunning XX, but where? using gfortran, -fbounds-check would give me a file and line number. Is there any way that I can get that with ifort?

like image 259
mgilson Avatar asked Feb 21 '13 16:02

mgilson


1 Answers

A -traceback flag may be used with Intel and Portland Group Fortran compilers to request additional information to be generated in object files for line and source traceback. When a severe error occurs during run time, the program will attempt to report line number and source file where the error occured, as well as line numbers and source files from parent procedures where the calls were made.

Equivalent flag for gfortran is -fbacktrace.

like image 73
milancurcic Avatar answered Nov 15 '22 19:11

milancurcic