From ce5458c277ba724e6558ba1b78161e70a4a73b76 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Wed, 30 Dec 2015 22:10:13 +0000 Subject: [PATCH] re PR libfortran/68987 (double free or corruption in _gfortran_st_write_done when a write statement to an internal file uses an invalid format and the ERR= specifier appears.) 2015-12-30 Jerry DeLisle PR fortran/68987 * gfortran.dg/error_format_2.f90: New test. From-SVN: r232007 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/error_format_2.f90 | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/error_format_2.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2981de99c58..ba9221cf4c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-30 Jerry DeLisle + + PR fortran/68987 + * gfortran.dg/error_format_2.f90: New test. + 2015-12-30 John David Anglin * gfortran.dg/coarray_40.f90: Revise to use dg-additional-options. diff --git a/gcc/testsuite/gfortran.dg/error_format_2.f90 b/gcc/testsuite/gfortran.dg/error_format_2.f90 new file mode 100644 index 00000000000..421da9a0261 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/error_format_2.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! PR68987, this test case failed on a memory double free +program foo + call s('(foo)') +end program +subroutine s(fmt) + character (*) :: fmt + character (1) :: c + integer :: i + write (c, fmt, iostat=i) 42 + ! print *, i + if (i==0) call abort() + write (c, fmt, err=100) 42 + call abort() +100 continue +end subroutine -- 2.30.2