gcc/fortran/
[official-gcc.git] / gcc / testsuite / gfortran.dg / newunit_1.f90
blob3a0c0b98cbe258fe09d0fb4b8c459634341e4aa4
1 ! { dg-do run }
2 ! PR40008 F2008: Add NEWUNIT= for OPEN statement
3 ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 program newunit_1
5 character(len=25) :: str
6 integer(1) :: myunit, myunit2
7 myunit = 25
8 str = "bad"
9 open(newunit=myunit, status="scratch")
10 open(newunit = myunit2, file="newunit_1file")
11 write(myunit,'(e24.15e2)') 1.0d0
12 write(myunit2,*) "abcdefghijklmnop"
13 flush(myunit)
14 rewind(myunit)
15 rewind(myunit2)
16 read(myunit2,'(a)') str
17 if (str.ne." abcdefghijklmnop") call abort
18 close(myunit)
19 close(myunit2, status="delete")
20 end program newunit_1