aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/negative_unit.f19
-rw-r--r--gcc/testsuite/gfortran.dg/negative_unit_int8.f16
-rw-r--r--gcc/testsuite/gfortran.dg/newunit_1.f9020
4 files changed, 44 insertions, 18 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 10445db..fead842 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/negative_unit.f b/gcc/testsuite/gfortran.dg/negative_unit.f
index 4f942e2..f1733a8 100644
--- a/gcc/testsuite/gfortran.dg/negative_unit.f
+++ b/gcc/testsuite/gfortran.dg/negative_unit.f
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/negative_unit_int8.f b/gcc/testsuite/gfortran.dg/negative_unit_int8.f
index 53a7daa..d4c3557 100644
--- a/gcc/testsuite/gfortran.dg/negative_unit_int8.f
+++ b/gcc/testsuite/gfortran.dg/negative_unit_int8.f
@@ -13,22 +13,22 @@
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
diff --git a/gcc/testsuite/gfortran.dg/newunit_1.f90 b/gcc/testsuite/gfortran.dg/newunit_1.f90
new file mode 100644
index 0000000..3a0c0b9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/newunit_1.f90
@@ -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