gcc/testsuite/gfortran.dg/error_format_2.f90
raw| 1 | ! { dg-do run } |
| 2 | ! PR68987, this test case failed on a memory double free |
| 3 | program foo |
| 4 | call s('(foo)') |
| 5 | end program |
| 6 | subroutine s(fmt) |
| 7 | character (*) :: fmt |
| 8 | character (1) :: c |
| 9 | integer :: i |
| 10 | write (c, fmt, iostat=i) 42 |
| 11 | ! print *, i |
| 12 | if (i==0) STOP 1 |
| 13 | write (c, fmt, err=100) 42 |
| 14 | STOP 2 |
| 15 | 100 continue |
| 16 | end subroutine |