From 5a82954466e9b717937ee4c343d83c271008f5a6 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sat, 5 Apr 2008 22:33:14 +0000 Subject: [PATCH] PR fortran/25829 28655 2008-04-05 Jerry DeLisle PR fortran/25829 28655 * gfortran.dg/f2003_io_1.f03: New test. * gfortran.dg/f2003_io_2.f03: New test. * gfortran.dg/f2003_io_3.f03: New test. * gfortran.dg/f2003_io_4.f03: New test. * gfortran.dg/f2003_io_5.f03: New test. * gfortran.dg/f2003_io_6.f03: New test. * gfortran.dg/f2003_io_7.f03: New test. From-SVN: r133945 --- gcc/testsuite/ChangeLog | 11 +++++++ gcc/testsuite/gfortran.dg/f2003_io_1.f03 | 37 ++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/f2003_io_2.f03 | 22 ++++++++++++++ gcc/testsuite/gfortran.dg/f2003_io_3.f03 | 21 ++++++++++++++ gcc/testsuite/gfortran.dg/f2003_io_4.f03 | 33 +++++++++++++++++++++ gcc/testsuite/gfortran.dg/f2003_io_5.f03 | 26 +++++++++++++++++ gcc/testsuite/gfortran.dg/f2003_io_6.f03 | 11 +++++++ gcc/testsuite/gfortran.dg/f2003_io_7.f03 | 27 +++++++++++++++++ 8 files changed, 188 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_1.f03 create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_2.f03 create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_3.f03 create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_4.f03 create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_5.f03 create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_6.f03 create mode 100644 gcc/testsuite/gfortran.dg/f2003_io_7.f03 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 720118a170e..18a45c19282 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2008-04-05 Jerry DeLisle + + PR fortran/25829 28655 + * gfortran.dg/f2003_io_1.f03: New test. + * gfortran.dg/f2003_io_2.f03: New test. + * gfortran.dg/f2003_io_3.f03: New test. + * gfortran.dg/f2003_io_4.f03: New test. + * gfortran.dg/f2003_io_5.f03: New test. + * gfortran.dg/f2003_io_6.f03: New test. + * gfortran.dg/f2003_io_7.f03: New test. + 2008-04-05 Richard Guenther PR tree-optimization/35833 diff --git a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 new file mode 100644 index 00000000000..0f8bebdded2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 @@ -0,0 +1,37 @@ +! { dg-do run } +! { dg-options "-std=gnu" } +! Test case prepared by Jerry DeLisle +real :: a(4), b(4) +real :: c +integer :: istat, j +character(25) :: msg + +a = 23.45 +b = 0.0 +open(10, file='mydata', asynchronous="yes", blank="null") + +write(10,'(10f8.3)', decimal="comma", id=j) a +rewind(10) +read(10,'(10f8.3)', asynchronous="yes", decimal="comma", blank="zero") b +if (any(b.ne.23.45)) call abort + +c = 3.14 +write(msg, *, decimal="comma") c +if (msg(1:7).ne." 3,14") call abort + +b = 0.0 +rewind(10) +write(10,'(10f8.3)', asynchronous="yes", decimal="point") a +rewind(10) +read(10,'(10f8.3)', asynchronous="yes", decimal="point") b +if (any(b.ne.23.45)) call abort + +wait(unit=10, err=25, iostat=istat, iomsg=msg, end=35, id=j) + +! do some stuff with a +25 continue + +35 continue + +close(10, status="delete") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_2.f03 b/gcc/testsuite/gfortran.dg/f2003_io_2.f03 new file mode 100644 index 00000000000..54c0516dfed --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_2.f03 @@ -0,0 +1,22 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! Test case prepared by Jerry DeLisle + +integer :: istat, idvar +character(25) :: msg +real, dimension(10) :: a, b + +a = 43.21 +open(10, file='mydata', asynchronous="yes") +write(10,'(10f8.3)', asynchronous="yes", decimal="comma") a +rewind(10) +read(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=idvar) b +istat = 123456 +wait(unit=10, err=25, iostat=istat, iomsg=msg, end=35, id=idvar) + +print *, istat + +25 continue + +35 continue +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_3.f03 b/gcc/testsuite/gfortran.dg/f2003_io_3.f03 new file mode 100644 index 00000000000..5b3fb59b0d7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_3.f03 @@ -0,0 +1,21 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! Test case prepared by Jerry DeLisle + +integer :: istat +character(25) :: msg +real, dimension(10) :: a, b +namelist /mynml/ a, b +msg = "null" +a = 43.21 +WRITE(99,'(10f8.3)',decimal="comma") a +rewind(99) +read(99,'(dc,10f8.3)',blank=msg) b +write(99,'(dp,10f8.3)',round="up") ! { dg-error "not implemented" } +rewind(99) +read(99,'(10f8.3)',pad="yes") +msg="suppress" +write(99,'(10f8.3)',sign=msg) +write(99,delim="apostrophe", fmt=*) +write(99,nml=mynml,delim="none") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 new file mode 100644 index 00000000000..d253a81bb64 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 @@ -0,0 +1,33 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle +! Test of decimal= feature + +integer :: istat +character(80) :: msg +real, dimension(4) :: a, b, c +namelist /mynml/ a, b +msg = "yes" +a = 43.21 +b = 3.131 +c = 5.432 +open(99, decimal="comma") +write(99,'(10f8.3)') a +a = 0.0 +rewind(99) +read(99,'(10f8.3)') a +if (any(a.ne.43.21)) call abort + +write(msg,'(dp,f8.3,dc,f8.2,dp,f8.3)', decimal="comma") a(1), b(1), c(1) +if (trim(msg).ne." 43.210 3,13 5.432") call abort + +close(99, status="delete") +open(99, decimal="comma") +write(99,nml=mynml) +a = 0.0 +b = 0.0 +rewind(99) +read(99,nml=mynml) +if (any(a.ne.43.21)) call abort +if (any(b.ne.3.131)) call abort +close(99, status="delete") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 new file mode 100644 index 00000000000..b816ded69c5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 @@ -0,0 +1,26 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle +! Test of decimal="comma" in namelist and complex +integer :: i +real :: a(10) = [ (i*1.3, i=1,10) ] +real :: b(10) +complex :: c +character(34) :: complex +namelist /nm/ a + +open(99,file="mynml",form="formatted",decimal="point",status="replace") +write(99,nml=nm,decimal="comma") +a = 5.55 +rewind(99) +read(99,nml=nm,decimal="comma") +if (any (a /= [ (i*1.3, i=1,10) ])) call abort +close(99, status="delete") + +c = (3.123,4.456) +write(complex,*,decimal="comma") c +if (complex.ne." ( 3,1229999 ; 4,4559999 )") call abort +c = (0.0, 0.0) +read(complex,*,decimal="comma") c +if (complex.ne." ( 3,1229999 ; 4,4559999 )") call abort + +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_6.f03 b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 new file mode 100644 index 00000000000..40758e2232d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 @@ -0,0 +1,11 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle +! Test of decimal="comma" in namelist, checks separators +implicit none +integer :: i +real :: a(6) = 0.0 +character(len=30) :: str = '&nm a = 1,3; 4, 5; 5; 7; /' +namelist /nm/ a +read(str,nml=nm,decimal='comma') +if (any(a.ne.[ 1.3, 4.0, 5.0, 5.0, 7.0, 0.0 ])) call abort +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 new file mode 100644 index 00000000000..6d2c11dfcbe --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 @@ -0,0 +1,27 @@ +! { dg-do run } +! Test case prepared by Jerry DeLisle +! Test of sign=, decimal=, and blank= . +program iotests + implicit none + character(len=45) :: a + character(len=4) :: mode = "what" + real, parameter :: pi = 3.14159265358979323846 + real(kind=8), dimension(3) :: b + ! + write(a,'(f10.3,s,f10.3,sp,f10.3,ss,f10.3)',SIGN='PLUS') pi, pi, pi, pi + if (a /= " +3.142 3.142 +3.142 3.142") call abort + ! + open(8,sign="plus") + write(8,'(f10.3,dc,f10.3,dp,f10.3)',DECIMAL='COMMA',& + & sign="suppress") pi, pi, pi + rewind(8) + read(8,'(a)') a + if (a /= " 3,142 3,142 3.142") call abort + close(8,status="delete") + ! + ! "123456789 123456789 12345678901 + write(a,'(a)') "53 256.84, 2 2 2. ; 33.3 3 1 " + read(a, '(f9.2,1x,f8.2,2x,f11.7)', blank="zero") b(1),b(2),b(3) + if (any(abs(b - [530256.84, 20202.00, 33.3030001]) > .03)) call abort +end program iotests + -- 2.30.2