1! Program to test intrinsic bitops
2program intrinsic_bitops
3   implicit none
4   integer(kind=4) :: i, j, k, o, t
5   integer(kind=8) :: a, b, c
6
7   o = 0
8   i = 2
9   j = 3
10   k = 12
11   a = 5
12
13   if (.not. btest (i, o+1)) call abort
14   if (btest (i, o+2)) call abort
15   if (iand (i, j) .ne. 2) call abort
16   if (ibclr (j, o+1) .ne. 1) call abort
17   if (ibclr (j, o+2) .ne. 3) call abort
18   if (ibits (k, o+1, o+2) .ne. 2) call abort
19   if (ibset (j, o+1) .ne. 3) call abort
20   if (ibset (j, o+2) .ne. 7) call abort
21   if (ieor (i, j) .ne. 1) call abort
22   if (ior (i, j) .ne. 3) call abort
23   if (ishft (k, o+2) .ne. 48) call abort
24   if (ishft (k, o-3) .ne. 1) call abort
25   if (ishft (k, o) .ne. 12) call abort
26   if (ishftc (k, o+30) .ne. 3) call abort
27   if (ishftc (k, o-30) .ne. 48) call abort
28   if (ishftc (k, o+1, o+3) .ne. 9) call abort
29   if (not (i) .ne. -3) call abort
30   if (ishftc (a, 1, bit_size(a)) .ne. 10) call abort
31   if (ishftc (1, 1, 32) .ne. 2) call abort
32end program
33