Debian Codegraph @

gcc/testsuite/gfortran.dg/read_legacy_comma.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-std=legacy" }
3 ! PR78351
4 program read_csv
5 implicit none
6 integer, parameter :: dbl = selected_real_kind(p=14, r=99)
7
8 call checkit("101,1.,2.,3.,7,7")
9 call checkit ("102,1.,,3.,,7")
10 call checkit (",1.,,3.,, ")
11
12 contains
13
14 subroutine checkit (text)
15 character(*) :: text
16 integer :: I1, I2, I3
17 real(dbl) :: R1, R2, R3
18 10 format (I8,3ES16.8,2I8)
19
20 I1=-99; I2=-99; I3=-99
21 R1=-99._DBL; R2=-99._DBL; R3=-99._DBL
22 read(text,10) I1, R1, R2, R3, I2, I3
23 if (I1 == -99) stop 1
24 if (I2 == -99) stop 2
25 if (I3 == -99) stop 3
26 if (R1 == -99._DBL) stop 4
27 if (R2 == -99._DBL) stop 5
28 if (R3 == -99._DBL) stop 6
29 end subroutine
30
31 end program