1! { dg-do run }
2!TODO: Move these testcases to gfortran testsuite
3! once compilation with pthreads is supported there
4! PR40008 F2008: Add NEWUNIT= for OPEN statement
5! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
6program newunit_1
7  character(len=25) :: str
8  integer(1) :: myunit, myunit2
9  myunit = 25
10  str = "bad"
11  open(newunit=myunit, status="scratch")
12  open(newunit = myunit2, file="newunit_1file")
13  write(myunit,'(e24.15e2)') 1.0d0
14  write(myunit2,*) "abcdefghijklmnop"
15  flush(myunit)
16  rewind(myunit)
17  rewind(myunit2)
18  read(myunit2,'(a)') str
19  if (str.ne." abcdefghijklmnop") stop 1
20  close(myunit)
21  close(myunit2, status="delete")
22end program newunit_1
23