annotate gcc/testsuite/gfortran.dg/read_comma.f @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run { target fd_truncate } }
kono
parents:
diff changeset
2 ! PR25039 This test checks that commas in input fields for formatted sequential
kono
parents:
diff changeset
3 ! reads are interpreted as the read completion. If no comma is encountered the
kono
parents:
diff changeset
4 ! normal field width determines the end of the read. The test case also checks
kono
parents:
diff changeset
5 ! that default blanks are interpreted as NULL in numerics.
kono
parents:
diff changeset
6 ! Test case derived from sample provided in PR by Iwan Kawrakow.
kono
parents:
diff changeset
7 ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
kono
parents:
diff changeset
8 !
kono
parents:
diff changeset
9 program pr25039
kono
parents:
diff changeset
10 implicit none
kono
parents:
diff changeset
11 integer :: i1, i2, i3
kono
parents:
diff changeset
12 character(10) :: a1
kono
parents:
diff changeset
13 open(10, status="scratch")
kono
parents:
diff changeset
14 write(10,'(a)') "1, 235"
kono
parents:
diff changeset
15 rewind(10)
kono
parents:
diff changeset
16 read(10,'(3i2)') i1,i2,i3
kono
parents:
diff changeset
17 if(i1.ne.1) call abort()
kono
parents:
diff changeset
18 if(i2.ne.2) call abort()
kono
parents:
diff changeset
19 if(i3.ne.35) call abort()
kono
parents:
diff changeset
20 rewind(10)
kono
parents:
diff changeset
21 ! Make sure commas are read in character strings.
kono
parents:
diff changeset
22 write(10,'(a)') "1234,6789,"
kono
parents:
diff changeset
23 rewind(10)
kono
parents:
diff changeset
24 read(10,'(a10)') a1
kono
parents:
diff changeset
25 if(a1.ne."1234,6789,") call abort()
kono
parents:
diff changeset
26 end