+2009-06-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/40008
+ * gfortran.dg/negative_unit.f: Update test.
+ * gfortran.dg/negative_unit_int8.f: Update test.
+ * gfortran.dg/newunit_1.f90: New test.
+
2009-06-07 Daniel Franke <franke.daniel@gmail.com>
PR fortran/25104
! Test case update by Jerry DeLisle <jvdelisle@gcc.gnu.org>
!
! Bugs submitted by Walt Brainerd
- integer i
+ integer i,j
logical l
- i = 0
+ i = -1
! gfortran created a 'fort.-1' file and wrote "Hello" in it
- write (unit=-1, fmt=*, iostat=i) "Hello"
- if (i <= 0) call abort
+ write (unit=i, fmt=*, iostat=j) "Hello"
+ if (j <= 0) call abort
- i = 0
- open (unit=-11, file="xxx", iostat=i)
- if (i <= 0) call abort
+ i = -11
+ open (unit=i, file="xxx", iostat=j)
+ if (j <= 0) call abort
- i = 0
- inquire (unit=-42, exist=l)
+ i = -42
+ inquire (unit=i, exist=l)
if (l) call abort
-
end
integer, parameter ::ERROR_BAD_UNIT = 5005
logical l
- i = 0
+ i = -1
! gfortran created a 'fort.-1' file and wrote "Hello" in it
- write (unit=-1, fmt=*, iostat=i) "Hello"
+ write (unit=i, fmt=*, iostat=i) "Hello"
if (i <= 0) call abort
- i = 0
- open (unit=-11, file="xxx", iostat=i)
+ i = -11
+ open (unit=i, file="xxx", iostat=i)
if (i <= 0) call abort
- i = 0
- inquire (unit=-42, exist=l)
+ i = -42
+ inquire (unit=i, exist=l)
if (l) call abort
- i = 0
+ i = 2_8*huge(0_4)+20_8
! This one is nasty
- inquire (unit=2_8*huge(0_4)+20_8, exist=l, iostat=i)
+ inquire (unit=i, exist=l, iostat=i)
if (l) call abort
if (i.ne.ERROR_BAD_UNIT) call abort
--- /dev/null
+! { dg-do run }
+! PR40008 F2008: Add NEWUNIT= for OPEN statement
+! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program newunit_1
+ character(len=25) :: str
+ integer(1) :: myunit, myunit2
+ myunit = 25
+ str = "bad"
+ open(newunit=myunit, status="scratch")
+ open(newunit = myunit2, file="newunit_1file")
+ write(myunit,'(e24.15e2)') 1.0d0
+ write(myunit2,*) "abcdefghijklmnop"
+ flush(myunit)
+ rewind(myunit)
+ rewind(myunit2)
+ read(myunit2,'(a)') str
+ if (str.ne." abcdefghijklmnop") call abort
+ close(myunit)
+ close(myunit2, status="delete")
+end program newunit_1