aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2016-01-21 21:08:00 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2016-01-21 21:08:00 +0000
commit2423a75aed79a349c3469f936fbc4ad30bf9b464 (patch)
tree63a91f11f9042c89e179f91d064d27fac834eacb /gcc
parent0a76463f6ed55231c4cf9a1d25faa72d3657c81b (diff)
downloadgcc-2423a75aed79a349c3469f936fbc4ad30bf9b464.zip
gcc-2423a75aed79a349c3469f936fbc4ad30bf9b464.tar.gz
gcc-2423a75aed79a349c3469f936fbc4ad30bf9b464.tar.bz2
re PR fortran/65996 (gfortran ICE with -dH)
2016-01-21 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. 2016-01-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/65996 gfortran.dg/pr65996.f90: New test. From-SVN: r232707
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/error.c9
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/pr65996.f9013
4 files changed, 34 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ee83c2e..9bd4ecf 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-21 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.
+
2016-01-19 Martin Jambor <mjambor@suse.cz>
* types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 457a3b0..7388706 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b5db7b6..dad2c35 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,8 +1,13 @@
+2016-01-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/65996
+ gfortran.dg/pr65996.f90: New test.
+
2016-01-21 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR c++/68810
* g++.dg/cpp0x/constexpr-reinterpret1.C: Fix line number that is
- expected to generate an error.
+ expected to generate an error.
2016-01-21 Bernd Schmidt <bschmidt@redhat.com>
diff --git a/gcc/testsuite/gfortran.dg/pr65996.f90 b/gcc/testsuite/gfortran.dg/pr65996.f90
new file mode 100644
index 0000000..754a3bc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr65996.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-additional-options "-dH" }
+! PR 65996.f90. before patch compiler aborted on this program.
+program foo
+ implicit none
+ character(len=16) :: a,b,c
+ a="XXX"
+ b="&
+ &XXX"
+ c="XXX &
+ & XXX"
+ write(0,*) 'a=',a,' b=',b,' c=',c
+endprogram foo