gcc/testsuite/gfortran.dg/iostat_1.f90
raw| 1 | ! { dg-do run } |
| 2 | ! PR 23598 - The iostat variable wasn't reset if the previous |
| 3 | ! I/O library call had an error. |
| 4 | program main |
| 5 | implicit none |
| 6 | integer :: ios, i |
| 7 | open (10, pad='no', status='scratch') |
| 8 | write (10, '(A)') '1','1' |
| 9 | rewind (10) |
| 10 | read (10,'(I2)',iostat=ios) i |
| 11 | ios = -4321 |
| 12 | read (10, '(I1)', iostat=ios) i |
| 13 | if (ios /= 0) STOP 1 |
| 14 | end program main |