2 ! Verify that the sizeof intrinsic does as advertised
3 subroutine check_int (j
)
4 INTEGER(4) :: i
, ia(5), ib(5,4), ip
, ipa(:)
10 if (sizeof (jb
) /= 2*sizeof (ib
)) call abort
12 if (sizeof(j
) == 4) then
13 if (sizeof (j
) /= sizeof (i
)) call abort
15 if (sizeof (j
) /= 2 * sizeof (i
)) call abort
20 l
= (/ sizeof(i
) == 4, sizeof(ia
) == 20, sizeof(ib
) == 80, &
21 sizeof(ip
) == 4, sizeof(ipa
) == 8, sizeof(ib(1:5:2,3)) == 12 /)
23 if (any(.not
.l
)) call abort
25 if (sizeof(l
) /= 6*sizeof(l(1))) call abort
26 end subroutine check_int
28 subroutine check_real (x
, y
)
30 real(4) :: r(20,20,20), rp(:,:)
33 double precision :: d(5,5)
34 complex(kind
=4) :: c(5)
36 if (sizeof (y
) /= 5*sizeof (x
)) call abort
38 if (sizeof (r
) /= 8000*4) call abort
40 if (sizeof (rp
) /= 45*4) call abort
42 if (sizeof (d
) /= 2*sizeof (rp
)) call abort
43 if (sizeof (c(1)) /= 2*sizeof(r(1,1,1))) call abort
44 end subroutine check_real
46 subroutine check_derived ()
64 integer(8) :: size_500
, size_200
, sizev500
, sizev200
66 real, allocatable
:: r(:)
68 real :: r(200), s(500)
71 if (sizeof(a
) /= sizeof(i
)) call abort
72 if (sizeof(oof
) /= sizeof(rab
)) call abort
75 size_500
= sizeof (v
%r
)
79 size_200
= sizeof (v
%r
)
81 if (size_500
- size_200
/= sizeof(s
) - sizeof(r
) .or
. sizev500
/= sizev200
) &
83 end subroutine check_derived
86 call check_real (1.0, (/1.0, 2.0, 3.0, 4.0, 5.0/))