re PR libfortran/68987 (double free or corruption in _gfortran_st_write_done when...
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 30 Dec 2015 22:10:13 +0000 (22:10 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 30 Dec 2015 22:10:13 +0000 (22:10 +0000)
2015-12-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/68987
* gfortran.dg/error_format_2.f90: New test.

From-SVN: r232007

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/error_format_2.f90 [new file with mode: 0644]

index 2981de99c58f9c23af54d6d087d4fbe6203ecc69..ba9221cf4c9b395288ac8f968f00e6e579c71099 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/68987
+       * gfortran.dg/error_format_2.f90: New test.
+
 2015-12-30  John David Anglin  <danglin@gcc.gnu.org>
 
        * 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 (file)
index 0000000..421da9a
--- /dev/null
@@ -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