PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / read_comma.f
blob2ef61c43de681eb005fef91bc685c9a454555d25
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>
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) STOP 1
18 if(i2.ne.2) STOP 2
19 if(i3.ne.35) STOP 3
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,") STOP 4
26 end