public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] PR65996 [5/6 Regression] gfortran ICE with -dH
@ 2016-01-18 19:01 Jerry DeLisle
  2016-01-21 20:25 ` Jerry DeLisle
  0 siblings, 1 reply; 2+ messages in thread
From: Jerry DeLisle @ 2016-01-18 19:01 UTC (permalink / raw)
  To: gfortran; +Cc: gcc patches

[-- Attachment #1: Type: text/plain, Size: 719 bytes --]

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.


[-- Attachment #2: pr65996.diff --]
[-- Type: text/x-patch, Size: 1131 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, fortran] PR65996 [5/6 Regression] gfortran ICE with -dH
  2016-01-18 19:01 [patch, fortran] PR65996 [5/6 Regression] gfortran ICE with -dH Jerry DeLisle
@ 2016-01-21 20:25 ` Jerry DeLisle
  0 siblings, 0 replies; 2+ messages in thread
From: Jerry DeLisle @ 2016-01-21 20:25 UTC (permalink / raw)
  To: gfortran; +Cc: gcc patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-21 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18 19:01 [patch, fortran] PR65996 [5/6 Regression] gfortran ICE with -dH Jerry DeLisle
2016-01-21 20:25 ` Jerry DeLisle

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