111
|
1 ! { dg-do run }
|
|
2 ! Test reading/writing of integer, real and character BOZ
|
|
3 ! non-integer BOZ are not valid in standard Fortran, however.
|
|
4 ! PR fortran/29625
|
|
5 program real_boz
|
|
6 implicit none
|
|
7 integer(4) :: i,i2
|
|
8 real(4) :: r,r2
|
|
9 complex(4) :: z,z2
|
|
10 character :: c,c2
|
|
11 character(len=100) :: str,fmt
|
|
12
|
|
13 i = 43
|
|
14 r = 325.56
|
|
15 z = cmplx(14.456, 345342.456)
|
|
16 c ='g'
|
|
17
|
|
18 write(str,'(b0)') i
|
|
19 write(fmt,'(a,i0,a)') '(b',len_trim(str),')'
|
|
20 read(str,fmt) i2
|
131
|
21 if(i /= i2) STOP 1
|
111
|
22
|
|
23 write(str,'(o0)') i
|
|
24 write(fmt,'(a,i0,a)') '(o',len_trim(str),')'
|
|
25 read(str,fmt) i2
|
131
|
26 if(i /= i2) STOP 2
|
111
|
27
|
|
28 write(str,'(z0)') i
|
|
29 write(fmt,'(a,i0,a)') '(z',len_trim(str),')'
|
|
30 read(str,fmt) i2
|
131
|
31 if(i /= i2) STOP 3
|
111
|
32
|
|
33
|
|
34 write(str,'(b0)') r
|
|
35 write(fmt,'(a,i0,a)') '(b',len_trim(str),')'
|
|
36 read(str,fmt) r2
|
131
|
37 if(r /= r2) STOP 4
|
111
|
38
|
|
39 write(str,'(o0)') r
|
|
40 write(fmt,'(a,i0,a)') '(o',len_trim(str),')'
|
|
41 read(str,fmt) r2
|
131
|
42 if(r /= r2) STOP 5
|
111
|
43
|
|
44 write(str,'(z0)') r
|
|
45 write(fmt,'(a,i0,a)') '(z',len_trim(str),')'
|
|
46 read(str,fmt) r2
|
131
|
47 if(r /= r2) STOP 6
|
111
|
48
|
|
49
|
|
50 write(str,'(b0)') c
|
|
51 write(fmt,'(a,i0,a)') '(b',len_trim(str),')'
|
|
52 read(str,fmt) c2
|
131
|
53 if(c /= c2) STOP 7
|
111
|
54
|
|
55 write(str,'(o0)') c
|
|
56 write(fmt,'(a,i0,a)') '(o',len_trim(str),')'
|
|
57 read(str,fmt) c2
|
131
|
58 if(c /= c2) STOP 8
|
111
|
59
|
|
60 write(str,'(z0)') c
|
|
61 write(fmt,'(a,i0,a)') '(z',len_trim(str),')'
|
|
62 read(str,fmt) c2
|
131
|
63 if(c /= c2) STOP 9
|
111
|
64
|
|
65 end program real_boz
|
|
66
|