From: Tobias Burnus <burnus@net-b.de>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: Fortran List <fortran@gcc.gnu.org>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, libfortran] PR 48915 Fix incorrect return code with -fdump-core, error handling changes
Date: Sat, 14 May 2011 15:19:00 -0000 [thread overview]
Message-ID: <4DCE58A9.3030409@net-b.de> (raw)
In-Reply-To: <BANLkTi=8wX5VKZRNWsCpd6B1RVtbp5sbaQ@mail.gmail.com>
Janne Blomqvist wrote: PR libfortran/48915
> * lang.opt: Remove -fdump-core.
Shouldn't one set this one to "Ignore" instead of removing it? In
particular as in a way the default option is kind of "-fdump-core"?
> * runtime/stop.c (stop_numeric): Call exit().
> (error_stop_string): Call sys_abort().
> (error_stop_numeric): Print backtrace, exit with provided code.
I disagree with the ERROR STOP change. The useful point about backtraces
is that one can find out where the program aborted. That's useful when
signalling NaN occurs, NULL pointers are dereferenced etc.
However, if either the program prints an error (ERROR STOP) or if the
library prints an error where the file/line number is in the error
message, it does not make sense to clutter the output by printing a
backtrace - especially not if the backtracing is enabled by default.
Thus, I do *not* want to see a backtrace for:
- STOP with non-zero exit code
- ERROR STOP
Both: One can easily grep the source code to find the relevant line.
Additionally, those messages usually print the exact problem - thus
there is no need to clutter the output.
- Opening an non-existing file
- Out-of-bounds array access
- Deallocating an nonallocated variable
Here, the reason is that the source line is ready printed in the error.
For instance:
At line 1 of file test.f90 (unit = 99, file = '�R')
Fortran runtime error: File 'nonexist' does not exist
Thus, I think one should to change ERROR STOP back to printing no
backtrace - at least not by default.
(I do not really mind backtraces for deallocation or out-of-bounds
errors; they occur rare enough and sometimes a backtrace can be useful
even if the line number is known.)
Additionally, it is *not* sufficient for ERROR STOP to only modify
libgfortran: For -fcoarray=lib, there is also an ERROR STOP version in
libgfortran/caf/{single,mpi}.c which should behave analogously - or one
changes the code there to call libgfortran's ERROR STOP version from there.
Other than that: Nice clean up. One probably should now also implement
backtracing support for Windows, which is not difficult (cf. attachment
in the MinGW backtrace PR).
Tobias
next prev parent reply other threads:[~2011-05-14 10:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-07 20:09 Janne Blomqvist
2011-05-13 10:28 ` Janne Blomqvist
2011-05-14 12:57 ` Steve Kargl
2011-05-14 15:19 ` Tobias Burnus [this message]
2011-05-14 18:20 ` Janne Blomqvist
2011-05-14 19:40 ` Tobias Burnus
2011-05-14 19:44 ` Janne Blomqvist
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DCE58A9.3030409@net-b.de \
--to=burnus@net-b.de \
--cc=blomqvist.janne@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).