This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR65996 [5/6 Regression] gfortran ICE with -dH
- From: Jerry DeLisle <jvdelisle at charter dot net>
- To: gfortran <fortran at gcc dot gnu dot org>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 18 Jan 2016 11:01:45 -0800
- Subject: [patch, fortran] PR65996 [5/6 Regression] gfortran ICE with -dH
- Authentication-results: sourceware.org; auth=none
This patch follows the suggestion Jakub made in the PR and is very straightforward.
With the patch, an abort is given on actual errors, in agreement with the
documentation for -dH.
(Yes, not very useful, but we can clear this PR)
Buffered errors bypass this abort by saving and restoring the state.
Regression tested on x86-64-linux.
OK for trunk and then back port to 5 in about a week?
A test case will be included, similar to that given by Dominique in the PR.
Regards,
Jerry
2016-01-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/65996
* error.c (gfc_error): Save the state of abort_on_error and set
it to false for buffered errors to allow normal processing.
Restore the state before leaving.
Index: error.c
===================================================================
--- error.c (revision 232535)
+++ error.c (working copy)
@@ -1226,6 +1226,7 @@ gfc_error (const char *gmsgid, va_list ap)
{
va_list argp;
va_copy (argp, ap);
+ bool saved_abort_on_error = false;
if (warnings_not_errors)
{
@@ -1250,10 +1251,14 @@ gfc_error (const char *gmsgid, va_list ap)
if (buffered_p)
{
+ /* To prevent -dH from triggering an abort on a buffered error,
+ save abort_on_error and restore it below. */
+ saved_abort_on_error = global_dc->abort_on_error;
+ global_dc->abort_on_error = false;
pp->buffer = pp_error_buffer;
global_dc->fatal_errors = false;
/* To prevent -fmax-errors= triggering, we decrease it before
- report_diagnostic increases it. */
+ report_diagnostic increases it. */
--errorcount;
}
@@ -1264,6 +1269,8 @@ gfc_error (const char *gmsgid, va_list ap)
{
pp->buffer = tmp_buffer;
global_dc->fatal_errors = fatal_errors;
+ global_dc->abort_on_error = saved_abort_on_error;
+
}
va_end (argp);