------- Comment #3 from burnus at gcc dot gnu dot org 2007-05-15 17:31 ------- Created an attachment (id=13558) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13558&action=view) Patch
> Since PR 30498 is fixed, gfortran supports backtraces. However, they are only > displayed for library errors not for, e.g., SEGV or signalling IEEE signals. > > A support for these can be found embedded in the patch at > http://gcc.gnu.org/ml/gcc-patches/2007-02/msg00747.html I extracted the non-committed parts of that patch. > Confirmed. We have to be careful how that interacts with user-installed signal > handlers, but it's otherwise a good idea. I think this should be no problem. They are set very early before any user command has been set. If a user uses signal, he can install a user handler instead which overwrites the handler in libgfortran, which is probably what the user wants. This covers: SIGSEGV, SIGILL, SIGFPE and SIGBUS Examples: a) uninitialized integer pointer: integer, pointer :: i; i = 5 Program received signal SIGILL: Segmentation fault Backtrace for this error: + /lib64/libc.so.6 [0x2af232dbf410] + function _fini (0x40084B) b) Division by zero with -ffpe-trap=zero Program received signal SIGFPE: Segmentation fault Backtrace for this error: + /lib64/libc.so.6 [0x2b20b66d3410] + in the main program at line 5 of file x.f90 + /lib64/libc.so.6(__libc_start_main+0xf4) [0x2b20b66c0944] For (a) the backtrace using gdb is similarly useless. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31189