c===========================================================
c     Demonstrates "wrap-around" nature of integer overflow.
c===========================================================
      program    intovr

      implicit   none

      integer    i4arg

      integer    i,     n,     base,   val

      n    = i4arg(1,-1)
      if( n .le. 0 ) then
         write(0,*) 'usage: intovr: <n> [<base>]'
      end if
      base = i4arg(2,1)

      val = base

      do i = 1 , n
         write(*,*) 'i = ', i, '  val = ', val
         val = 2 * val
      end do

      stop

      end
