PROGRAM test_allocate

  IMPLICIT NONE

  integer, ALLOCATABLE :: zz(:, :, :)
  INTEGER nn

  !---------------------------------------

  print *, "nn = ? "
  read *, nn
  print *, "memory usage: ", real(nn)**3 * bit_size(0) / 8. / real(1024**2), &
       "MiB"
  ALLOCATE(zz(nn, nn, nn))
  print *, "allocate completed"
  zz = 3
  PRINT *, "zz(", nn, ",", nn, ",", nn, ") = ", zz(nn, nn, nn)
  print *, "size(zz) = ", size(zz)

END PROGRAM test_allocate
