[gfortran,patch] Allow backtracing non-library errors

Thomas Koenig tkoenig@alice-dsl.net
Sun Aug 5 09:20:00 GMT 2007


On Sat, 2007-08-04 at 22:55 +0100, FX Coudert wrote:

:REVIEWMAIL:

> Bootstrapped and regtested on x86_64-linux, no testcase because of  
> the nature of the patch, documentation adjusted to describe the new  
> behaviour. OK to commit?
> FX

Hi FX,

the patch compiles and regtests ok on i686-pc-linux-gnu (Debian
testing).

I can't get it to produce meaningful backtraces, though:

$ cat u3.f90 
   real :: x
   x = -1
   x = sqrt(x)
   print *, x
   end
$ 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]

Backtracing from a normal library function works:

$ cat matmul.f90 
program main
  real, dimension (3,3) :: a
  real, allocatable :: b(:)
  allocate(b(2))
  call random_number(a)
  call random_number(b)
  print *,matmul(a,b)
end program main
$ gfortran -g -fbacktrace matmul.f90 && ./a.out
Fortran runtime error: dimension of array B incorrect in MATMUL
intrinsic

Backtrace for this error:
  + in the main program
    at line 7 of file matmul.f90
  + /lib/i686/cmov/libc.so.6(__libc_start_main+0xe0) [0xb7db4030]

Any ideas?

	Thomas



More information about the Fortran mailing list