diff mbox

[fortran] PR65996 [5/6 Regression] gfortran ICE with -dH

Message ID 569D3699.4040700@charter.net
State New
Headers show

Commit Message

Jerry DeLisle Jan. 18, 2016, 7:01 p.m. UTC
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.

Comments

Jerry DeLisle Jan. 21, 2016, 8:25 p.m. UTC | #1
On 01/18/2016 11:01 AM, Jerry DeLisle wrote:
> This patch follows the suggestion Jakub made in the PR and is very straightforward.
> 

The patch is simple enough.  I will commit to trunk shortly if I hear from no one.

Regards,

Jerry

> 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.
>
diff mbox

Patch

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);