The problem is that diagnostic_action_after_output tries to delete the active pretty...
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 24 Jun 2015 22:16:42 +0000 (22:16 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 24 Jun 2015 22:16:42 +0000 (22:16 +0000)
commit5862c189c2c3c26864ed9931178f8220ccee701c
treee81edd67a3b77dde68f383afc975aefbcbc1092d
parentb6d10e0b06b82a100a695ae13659c71be34bb032
The problem is that diagnostic_action_after_output tries to delete the active pretty-printer which tries to delete its output_buffer...

The problem is that diagnostic_action_after_output tries to delete the active
pretty-printer which tries to delete its output_buffer, which is normally
dynamically allocated via placement-new, but the output_buffer used by the
error_buffer of Fortran is statically allocated. Being statically allocated
simplifies a lot pushing/poping several instances of error_buffer.

The solution is to reset the active output_buffer back to the default one
before calling diagnostic_action_after_output. This is a bit ugly, because this
function does use the output_buffer, however, at the point that Fortran calls
it, both are in an equivalent state, thus there is no visible difference.

gcc/testsuite/ChangeLog:

2015-06-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR fortran/66528
* gfortran.dg/maxerrors.f90: New test.

gcc/fortran/ChangeLog:

2015-06-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR fortran/66528
* error.c (gfc_warning_check): Restore the default output_buffer
before calling diagnostic_action_after_output.
(gfc_error_check): Likewise.
(gfc_diagnostics_init): Add comment.

From-SVN: r224926
gcc/fortran/ChangeLog
gcc/fortran/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/maxerrors.f90 [new file with mode: 0644]