[gfortran,patch, RFC] Allow coredump and backtrace on runtime error

Tobias Burnus burnus@net-b.de
Sun Nov 26 23:36:00 GMT 2006



I didn't yet look carefully at the patch, but does it also give a
backtrace for errors which occur outside the library? Example:

  r1 = 0.0
  b = 0.0/r1 ! compile with -ffpe-trap=invalid

Jerry DeLisle wrote:
> François-Xavier Coudert wrote:
>>  -- I made -fbacktrace the default behaviour, because it doesn't cost
>> a CPU cycle during execution. Do you think that makes the output too
>> verbose?
> I don't think we need all the clutter.  I think that if a user is
> knowledgeable and can use a backtrace, they can ask for it.  For most
> errors it is not needed.

I strongly agree with this. Example:
   open(77,name="not-existing.dat", status="old")
current gfortran result:
  At line 1 of file xxx.f90
  Fortran runtime error: No such file or directory

(Side note: as this happens in open() and a name is given, I think one
could really output the file name as well)

That way one sees on the spot where the problem is. Counter example
ifort (with trace enabled by default):

forrtl: No such file or directory
forrtl: severe (29): file not found, unit 77, file /dev/shm/not-existing.dat
Image              PC                Routine            Line        Source
a.out              00000000004394E6  Unknown               Unknown  Unknown
a.out              000000000043809E  Unknown               Unknown  Unknown
a.out              00000000004214F0  Unknown               Unknown  Unknown
a.out              0000000000416602  Unknown               Unknown  Unknown
a.out              0000000000416263  Unknown               Unknown  Unknown
a.out              0000000000405F3B  Unknown               Unknown  Unknown
a.out              00000000004026F5  Unknown               Unknown  Unknown
a.out              000000000040266A  Unknown               Unknown  Unknown
libc.so.6          00002B41F8C90AE4  Unknown               Unknown  Unknown
a.out              00000000004025A9  Unknown               Unknown  Unknown

Here it takes much longer until one has realized what went wrong. The
only thing which is better is that the file name is given.


More information about the Gcc-patches mailing list