OSDN Git Service

2010-04-24 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / read_comma.f
1 ! { dg-do run { target fd_truncate } }
2 ! PR25039 This test checks that commas in input fields for formatted sequential
3 ! reads are interpreted as the read completion.  If no comma is encountered the
4 ! normal field width determines the end of the read.  The test case also checks
5 ! that default blanks are interpreted as NULL in numerics.
6 ! Test case derived from sample provided in PR by Iwan Kawrakow.
7 ! Contributed by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
8 !
9       program pr25039
10       implicit none
11       integer :: i1, i2, i3
12       character(10) :: a1
13       open(10, status="scratch")
14       write(10,'(a)') "1, 235"
15       rewind(10)
16       read(10,'(3i2)') i1,i2,i3
17       if(i1.ne.1) call abort()
18       if(i2.ne.2) call abort()
19       if(i3.ne.35) call abort()
20       rewind(10)
21 !     Make sure commas are read in character strings.      
22       write(10,'(a)') "1234,6789,"
23       rewind(10)
24       read(10,'(a10)') a1
25       if(a1.ne."1234,6789,") call abort()
26       end