[gfortran,patch] Allow backtracing non-library errors

Tobias Burnus burnus@net-b.de
Sun Aug 5 09:54:00 GMT 2007


Hi Thomas,

Thomas Koenig wrote:
> I can't get it to produce meaningful backtraces, though:
>    x = sqrt(x)
> $ gfortran -g  -fbacktrace -ffpe-trap=invalid u3.f90 && ./a.out
>
> Program received signal 8 (SIGFPE): Floating-point exception.
> Backtrace for this error:
>   + /lib/i686/cmov/libc.so.6 [0xb7ce1208]
>   + /lib/i686/cmov/libc.so.6(__libc_start_main+0xe0) [0xb7ccd030]
>   
For your test case I get:

Program received signal 8 (SIGFPE): Floating-point exception.
Backtrace for this error:
  + /lib64/libc.so.6 [0x2aefddcf1b20]
  + in the main program
    at line 3 of file a.f90
  + /lib64/libc.so.6(__libc_start_main+0xf4) [0x2aefddcdeb54]

However, using
  integer, pointer :: x
  x = 5
  end

I also don't get a useful backtrace:
Program received signal 11 (SIGSEGV): Segmentation fault.
Backtrace for this error:
  + /lib64/libc.so.6 [0x2ab873638b20]
  + function _fini (0x400850)

but gdb has also no better backtrace:
Program received signal SIGILL, Illegal instruction.
#0  0x00000000004007ed in _fini ()
#1  0x00002b154ef6eb96 in ?? () from /lib64/ld-linux-x86-64.so.2
#2  0x00002b154f9042ce in exit () from /lib64/libc.so.6
#3  0x00002b154f8eeb5b in __libc_start_main () from /lib64/libc.so.6
#4  0x00000000004005e9 in _start ()

Ifort has for whatever reason a better backtrace in this case (with
-traceback and also in gdb):

Program received signal SIGSEGV, Segmentation fault.
0x000000000040279b in main$aa_$BLK () at aa.f90:2
2       x = 5
Current language:  auto; currently fortran
#0  0x000000000040279b in main$aa_$BLK () at aa.f90:2
#1  0x000000000040276a in main ()


Tobias



More information about the Fortran mailing list