PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / list_read_3.f90
blobc8a21c6793d635661dcea0e011a6f54dca803978
1 ! { dg-do run }
2 ! Program to test reading in a list of integer values into REAL variables.
3 ! The comma separator was not handled correctly.
5 program fg
7 character(len=80) buff
8 logical debug
10 debug = .FALSE.
11 a = 0
12 b = 0
13 c = 0
14 d = 0
15 write (buff,'(a)') '10,20,30,40'
16 read(buff,*) a, b, c, d
18 if (debug) then
19 print*,buff
20 print*,a, b, c, d
21 end if
23 if (abs(10. - a) > 1e-5) STOP 1
24 if (abs(20. - b) > 1e-5) STOP 2
25 if (abs(30. - c) > 1e-5) STOP 3
26 if (abs(40. - d) > 1e-5) STOP 4
28 a = 0
29 b = 0
30 c = 0
31 d = 0
32 write (buff,'(a)') '10.,20.,30.,40.'
33 read(buff,*) a, b, c, d
35 if (abs(10. - a) > 1e-5) STOP 5
36 if (abs(20. - b) > 1e-5) STOP 6
37 if (abs(30. - c) > 1e-5) STOP 7
38 if (abs(40. - d) > 1e-5) STOP 8
40 if (debug) then
41 print*,buff
42 print*,a, b, c, d
43 end if
45 a = 0
46 b = 0
47 c = 0
48 d = 0
49 write (buff,'(a)') '10.0,20.0,30.0,40.0'
50 read(buff,*) a, b, c, d
52 if (abs(10. - a) > 1e-5) STOP 9
53 if (abs(20. - b) > 1e-5) STOP 10
54 if (abs(30. - c) > 1e-5) STOP 11
55 if (abs(40. - d) > 1e-5) STOP 12
57 if (debug) then
58 print*,buff
59 print*,a, b, c, d
60 end if
63 a = 0
64 b = -99
65 c = 0
66 d = 0
67 write (buff,'(a)') '10.0,,30.0,40.0'
68 read(buff,*) a, b, c, d
70 if (abs(10. - a) > 1e-5) STOP 13
71 if (abs(-99. - b) > 1e-5) STOP 14
72 if (abs(30. - c) > 1e-5) STOP 15
73 if (abs(40. - d) > 1e-5) STOP 16
75 if (debug) then
76 print*,buff
77 print*,a, b, c, d
78 end if
81 call abc
83 end program
85 subroutine abc
87 character(len=80) buff
89 a = 0
90 b = 0
91 c = 0
92 d = 0
93 write (buff,'(a)') '10,-20,30,-40'
94 read(buff,*) a, b, c, d
96 if (abs(10. - a) > 1e-5) STOP 17
97 if (abs(-20. - b) > 1e-5) STOP 18
98 if (abs(30. - c) > 1e-5) STOP 19
99 if (abs(-40. - d) > 1e-5) STOP 20
101 end subroutine abc