PR fortran/25829 28655
2008-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> 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
This commit is contained in:
parent
6f0f0b2eca
commit
5a82954466
@ -1,3 +1,14 @@
|
||||
2008-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
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 <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/35833
|
||||
|
37
gcc/testsuite/gfortran.dg/f2003_io_1.f03
Normal file
37
gcc/testsuite/gfortran.dg/f2003_io_1.f03
Normal file
@ -0,0 +1,37 @@
|
||||
! { dg-do run }
|
||||
! { dg-options "-std=gnu" }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
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
|
22
gcc/testsuite/gfortran.dg/f2003_io_2.f03
Normal file
22
gcc/testsuite/gfortran.dg/f2003_io_2.f03
Normal file
@ -0,0 +1,22 @@
|
||||
! { dg-do compile }
|
||||
! { dg-options "-std=f2003" }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
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
|
21
gcc/testsuite/gfortran.dg/f2003_io_3.f03
Normal file
21
gcc/testsuite/gfortran.dg/f2003_io_3.f03
Normal file
@ -0,0 +1,21 @@
|
||||
! { dg-do compile }
|
||||
! { dg-options "-std=f2003" }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
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
|
33
gcc/testsuite/gfortran.dg/f2003_io_4.f03
Normal file
33
gcc/testsuite/gfortran.dg/f2003_io_4.f03
Normal file
@ -0,0 +1,33 @@
|
||||
! { dg-do run }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
! 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
|
26
gcc/testsuite/gfortran.dg/f2003_io_5.f03
Normal file
26
gcc/testsuite/gfortran.dg/f2003_io_5.f03
Normal file
@ -0,0 +1,26 @@
|
||||
! { dg-do run }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
! 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
|
11
gcc/testsuite/gfortran.dg/f2003_io_6.f03
Normal file
11
gcc/testsuite/gfortran.dg/f2003_io_6.f03
Normal file
@ -0,0 +1,11 @@
|
||||
! { dg-do run }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
! 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
|
27
gcc/testsuite/gfortran.dg/f2003_io_7.f03
Normal file
27
gcc/testsuite/gfortran.dg/f2003_io_7.f03
Normal file
@ -0,0 +1,27 @@
|
||||
! { dg-do run }
|
||||
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
! 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
|
||||
|
Loading…
Reference in New Issue
Block a user