2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / boz_15.f90
blobf481f16e80e578970ff4c1f683484ce7cb4684e3
1 ! { dg-do run }
2 ! { dg-require-effective-target fortran_large_real }
3 ! { dg-require-effective-target fortran_large_int }
5 ! PR fortran/41711
7 ! Check reading and writing of real(10/16) BOZ,
8 ! which needs integer(16) support.
10 implicit none
11 character(len=256) :: str
12 integer,parameter :: xp = selected_real_kind (precision (0.0d0)+1)
13 real(xp) :: r1,r2
14 complex(xp) :: z1,z2
16 r2 = 5.0_xp
17 r1 = 2.0_xp
18 ! Real B(OZ)
19 write(str,'(b128)') r1
20 read (str,'(b128)') r2
21 if(r2 /= r1) call abort()
22 ! Real (B)O(Z)
23 r2 = 5.0_xp
24 write(str,'(o126)') r1
25 read (str,'(o126)') r2
26 if(r2 /= r1) call abort()
27 ! Real (BO)Z
28 r2 = 5.0_xp
29 write(str,'(z126)') r1
30 read (str,'(z126)') r2
31 if(r2 /= r1) call abort()
33 z2 = cmplx(5.0_xp,7.0_xp)
34 z1 = cmplx(2.0_xp,3.0_xp)
35 ! Complex B(OZ)
36 write(str,'(2b128)') z1
37 read (str,'(2b128)') z2
38 if(z2 /= z1) call abort()
39 ! Complex (B)O(Z)
40 z2 = cmplx(5.0_xp,7.0_xp)
41 write(str,'(2o126)') z1
42 read (str,'(2o126)') z2
43 if(z2 /= z1) call abort()
44 ! Complex (BO)Z
45 z2 = cmplx(5.0_xp,7.0_xp)
46 write(str,'(2z126)') z1
47 read (str,'(2z126)') z2
48 if(z2 /= z1) call abort()
49 end