From 28300f5aa79748a22b54f4bbe9654bf87b21b286 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sun, 7 Jun 2009 19:07:46 +0000 Subject: [PATCH] re PR fortran/40008 (F2008: Add NEWUNIT= for OPEN statement) 2009-06-07 Jerry DeLisle 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. From-SVN: r148255 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gfortran.dg/negative_unit.f | 19 +++++++++---------- gcc/testsuite/gfortran.dg/negative_unit_int8.f | 16 ++++++++-------- gcc/testsuite/gfortran.dg/newunit_1.f90 | 20 ++++++++++++++++++++ 4 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/newunit_1.f90 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 + + 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 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 ! ! 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 +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 -- 2.7.4