OSDN Git Service

2009-06-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Jun 2009 19:07:46 +0000 (19:07 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Jun 2009 19:07:46 +0000 (19:07 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148255 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/negative_unit.f
gcc/testsuite/gfortran.dg/negative_unit_int8.f
gcc/testsuite/gfortran.dg/newunit_1.f90 [new file with mode: 0644]

index 10445db..fead842 100644 (file)
@@ -1,3 +1,10 @@
+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
index 4f942e2..f1733a8 100644 (file)
@@ -6,20 +6,19 @@
 ! 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
index 53a7daa..d4c3557 100644 (file)
       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 = 
+      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
 
diff --git a/gcc/testsuite/gfortran.dg/newunit_1.f90 b/gcc/testsuite/gfortran.dg/newunit_1.f90
new file mode 100644 (file)
index 0000000..3a0c0b9
--- /dev/null
@@ -0,0 +1,20 @@
+! { 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