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