2018-09-30 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / io_real_boz.f90
blob2f51dc6a5c9e9366efd602976221b75e14b990f6
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
13 i = 43
14 r = 325.56
15 z = cmplx(14.456, 345342.456)
16 c ='g'
18 write(str,'(b0)') i
19 write(fmt,'(a,i0,a)') '(b',len_trim(str),')'
20 read(str,fmt) i2
21 if(i /= i2) STOP 1
23 write(str,'(o0)') i
24 write(fmt,'(a,i0,a)') '(o',len_trim(str),')'
25 read(str,fmt) i2
26 if(i /= i2) STOP 2
28 write(str,'(z0)') i
29 write(fmt,'(a,i0,a)') '(z',len_trim(str),')'
30 read(str,fmt) i2
31 if(i /= i2) STOP 3
34 write(str,'(b0)') r
35 write(fmt,'(a,i0,a)') '(b',len_trim(str),')'
36 read(str,fmt) r2
37 if(r /= r2) STOP 4
39 write(str,'(o0)') r
40 write(fmt,'(a,i0,a)') '(o',len_trim(str),')'
41 read(str,fmt) r2
42 if(r /= r2) STOP 5
44 write(str,'(z0)') r
45 write(fmt,'(a,i0,a)') '(z',len_trim(str),')'
46 read(str,fmt) r2
47 if(r /= r2) STOP 6
50 write(str,'(b0)') c
51 write(fmt,'(a,i0,a)') '(b',len_trim(str),')'
52 read(str,fmt) c2
53 if(c /= c2) STOP 7
55 write(str,'(o0)') c
56 write(fmt,'(a,i0,a)') '(o',len_trim(str),')'
57 read(str,fmt) c2
58 if(c /= c2) STOP 8
60 write(str,'(z0)') c
61 write(fmt,'(a,i0,a)') '(z',len_trim(str),')'
62 read(str,fmt) c2
63 if(c /= c2) STOP 9
65 end program real_boz