| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-fno-range-check" } |
| 3 |
! |
| 4 |
! PR fortran/34342 |
| 5 |
! |
| 6 |
! Test for Fortran 2003 BOZ. |
| 7 |
! |
| 8 |
program f2003 |
| 9 |
implicit none |
| 10 |
|
| 11 |
real,parameter :: r2c = real(int(z'3333')) |
| 12 |
real,parameter :: rc = real(z'50CB9F09') |
| 13 |
double precision,parameter :: dc = dble(Z'3FD34413509F79FF') |
| 14 |
complex,parameter :: z1c = cmplx(b'11000001010001101101110110000011', 3.049426e-10) |
| 15 |
complex,parameter :: z2c = cmplx(4.160326e16, o'6503667306') |
| 16 |
|
| 17 |
real :: r2 = real(int(z'3333')) |
| 18 |
real :: r = real(z'50CB9F09') |
| 19 |
double precision :: d = dble(Z'3FD34413509F79FF') |
| 20 |
complex :: z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10) |
| 21 |
complex :: z2 = cmplx(4.160326e16, o'6503667306') |
| 22 |
|
| 23 |
if (r2c /= 13107.0) STOP 1 |
| 24 |
if (rc /= 2.732958e10) STOP 2 |
| 25 |
if (dc /= 0.30102999566398120d0) STOP 3 |
| 26 |
if (real(z1c) /= -1.242908e1 .or. aimag(z1c) /= 3.049426e-10) STOP 4 |
| 27 |
if (real(z2c) /= 4.160326e16 .or. aimag(z2c) /= 5.343285e-7) STOP 5 |
| 28 |
|
| 29 |
if (r2 /= 13107.0) STOP 6 |
| 30 |
if (r /= 2.732958e10) STOP 7 |
| 31 |
if (d /= 0.30102999566398120d0) STOP 8 |
| 32 |
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) STOP 9 |
| 33 |
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) STOP 10 |
| 34 |
|
| 35 |
r2 = dble(int(z'3333')) |
| 36 |
r = real(z'50CB9F09') |
| 37 |
d = dble(Z'3FD34413509F79FF') |
| 38 |
z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10) |
| 39 |
z2 = cmplx(4.160326e16, o'6503667306') |
| 40 |
|
| 41 |
if (r2 /= 13107d0) STOP 11 |
| 42 |
if (r /= 2.732958e10) STOP 12 |
| 43 |
if (d /= 0.30102999566398120d0) STOP 13 |
| 44 |
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) STOP 14 |
| 45 |
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) STOP 15 |
| 46 |
|
| 47 |
call test4() |
| 48 |
call test8() |
| 49 |
|
| 50 |
contains |
| 51 |
|
| 52 |
subroutine test4 |
| 53 |
real,parameter :: r2c = real(int(z'3333', kind=4), kind=4) |
| 54 |
real,parameter :: rc = real(z'50CB9F09', kind=4) |
| 55 |
complex,parameter :: z1c = cmplx(b'11000001010001101101110110000011', 3.049426e-10, kind=4) |
| 56 |
complex,parameter :: z2c = cmplx(4.160326e16, o'6503667306', kind=4) |
| 57 |
|
| 58 |
real :: r2 = real(int(z'3333', kind=4), kind=4) |
| 59 |
real :: r = real(z'50CB9F09', kind=4) |
| 60 |
complex :: z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10, kind=4) |
| 61 |
complex :: z2 = cmplx(4.160326e16, o'6503667306', kind=4) |
| 62 |
|
| 63 |
if (r2c /= 13107.0) STOP 16 |
| 64 |
if (rc /= 2.732958e10) STOP 17 |
| 65 |
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) STOP 18 |
| 66 |
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) STOP 19 |
| 67 |
|
| 68 |
if (r2 /= 13107.0) STOP 20 |
| 69 |
if (r /= 2.732958e10) STOP 21 |
| 70 |
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) STOP 22 |
| 71 |
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) STOP 23 |
| 72 |
|
| 73 |
r2 = real(int(z'3333'), kind=4) |
| 74 |
r = real(z'50CB9F09', kind=4) |
| 75 |
z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10, kind=4) |
| 76 |
z2 = cmplx(4.160326e16, o'6503667306', kind=4) |
| 77 |
|
| 78 |
if (r2 /= 13107.0) STOP 24 |
| 79 |
if (r /= 2.732958e10) STOP 25 |
| 80 |
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) STOP 26 |
| 81 |
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) STOP 27 |
| 82 |
end subroutine test4 |
| 83 |
|
| 84 |
|
| 85 |
subroutine test8 |
| 86 |
real(8),parameter :: r2c = real(int(z'FFFFFF3333', kind=8), kind=8) |
| 87 |
real(8),parameter :: rc = real(z'AAAAAFFFFFFF3333', kind=8) |
| 88 |
complex(8),parameter :: z1c = cmplx(b'11111011111111111111111111111111111111111111111111111111110101',-4.0, kind=8) |
| 89 |
complex(8),parameter :: z2c = cmplx(5.0, o'442222222222233301245', kind=8) |
| 90 |
|
| 91 |
real(8) :: r2 = real(int(z'FFFFFF3333',kind=8),kind=8) |
| 92 |
real(8) :: r = real(z'AAAAAFFFFFFF3333', kind=8) |
| 93 |
complex(8) :: z1 = cmplx(b'11111011111111111111111111111111111111111111111111111111110101',-4.0, kind=8) |
| 94 |
complex(8) :: z2 = cmplx(5.0, o'442222222222233301245', kind=8) |
| 95 |
|
| 96 |
if (r2c /= 1099511575347.0d0) STOP 28 |
| 97 |
if (rc /= -3.72356884822177915d-103) STOP 29 |
| 98 |
if (real(z1c) /= 3.05175781249999627d-5 .or. aimag(z1c) /= -4.0) STOP 30 |
| 99 |
if (real(z2c) /= 5.0 .or. aimag(z2c) /= 3.98227593015308981d41) STOP 31 |
| 100 |
|
| 101 |
if (r2 /= 1099511575347.0d0) STOP 32 |
| 102 |
if (r /= -3.72356884822177915d-103) STOP 33 |
| 103 |
if (real(z1) /= 3.05175781249999627d-5 .or. aimag(z1) /= -4.0) STOP 34 |
| 104 |
if (real(z2) /= 5.0 .or. aimag(z2) /= 3.98227593015308981d41) STOP 35 |
| 105 |
|
| 106 |
r2 = real(int(z'FFFFFF3333',kind=8),kind=8) |
| 107 |
r = real(z'AAAAAFFFFFFF3333', kind=8) |
| 108 |
z1 = cmplx(b'11111011111111111111111111111111111111111111111111111111110101',-4.0, kind=8) |
| 109 |
z2 = cmplx(5.0, o'442222222222233301245', kind=8) |
| 110 |
|
| 111 |
if (r2 /= 1099511575347.0d0) STOP 36 |
| 112 |
if (r /= -3.72356884822177915d-103) STOP 37 |
| 113 |
if (real(z1) /= 3.05175781249999627d-5 .or. aimag(z1) /= -4.0) STOP 38 |
| 114 |
if (real(z2) /= 5.0 .or. aimag(z2) /= 3.98227593015308981d41) STOP 39 |
| 115 |
|
| 116 |
end subroutine test8 |
| 117 |
|
| 118 |
end program f2003 |