111
|
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.
|
|
4 !
|
|
5 program fg
|
|
6
|
|
7 character(len=80) buff
|
|
8 logical debug
|
|
9
|
|
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
|
|
17
|
|
18 if (debug) then
|
|
19 print*,buff
|
|
20 print*,a, b, c, d
|
|
21 end if
|
|
22
|
131
|
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
|
111
|
27
|
|
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
|
|
34
|
131
|
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
|
111
|
39
|
|
40 if (debug) then
|
|
41 print*,buff
|
|
42 print*,a, b, c, d
|
|
43 end if
|
|
44
|
|
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
|
|
51
|
131
|
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
|
111
|
56
|
|
57 if (debug) then
|
|
58 print*,buff
|
|
59 print*,a, b, c, d
|
|
60 end if
|
|
61
|
|
62
|
|
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
|
|
69
|
131
|
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
|
111
|
74
|
|
75 if (debug) then
|
|
76 print*,buff
|
|
77 print*,a, b, c, d
|
|
78 end if
|
|
79
|
|
80
|
|
81 call abc
|
|
82
|
|
83 end program
|
|
84
|
|
85 subroutine abc
|
|
86
|
|
87 character(len=80) buff
|
|
88
|
|
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
|
|
95
|
131
|
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
|
111
|
100
|
|
101 end subroutine abc
|