1! Program to test the DIM intrinsic
2program intrinsic_dim
3   implicit none
4   integer i, j
5   real(kind=4) :: r, s
6   real(kind=8) :: p, q
7
8   i = 1
9   j = 4
10   if (dim (i, j) .ne. 0) STOP 1
11   if (dim (j, i) .ne. 3) STOP 2
12   r = 1.0
13   s = 4.0
14   if (dim (r, s) .ne. 0.0) STOP 3
15   if (dim (s, r) .ne. 3.0) STOP 4
16   p = 1.0
17   q = 4.0
18   if (dim (p, q) .ne. 0.0) STOP 5
19   if (dim (q, p) .ne. 3.0) STOP 6
20end program
21