      program bnd11
      implicit none
 
! This is a diagnostic test to detect bound violation on an allocatable array.
! Originally contributed by Sylvain Bergeron, modified by Polyhedron Software.
! Failed if program completes without an error.
 
      type TObject
         integer, pointer :: Array(:)
      end type
 
      integer k
      type(TObject), pointer :: Var(:)
 
      allocate(Var(1))
      allocate(Var(1)%Array(10))
 
      k = 1
      do
         Var(1)%Array(k) = k
         k = k + 1
      enddo
 
      print *, sum(Var(1)%Array)
      end
