OSDN Git Service

2010-04-24 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / nullify_3.f90
1 ! { dg-do run }
2 ! { dg-options "-O0 -fbounds-check" }
3 ! Tests patch for PR29371, in which the null pointer
4 ! assignment would cause a segfault with the bounds
5 ! check on.
6 !
7 ! Contributed by Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
8 !
9 program test
10   implicit none
11   type projector_t
12     real,   pointer :: ket(:, :), bra(:, :)
13   end type projector_t
14
15   type(projector_t),pointer, dimension(:) :: p
16   integer :: stat,i
17   allocate(p(2),stat=stat)
18   do i = 1, 2
19         nullify(p(i)%bra)
20         nullify(p(i)%ket)
21   end do
22   do i = 1, 2
23         if (associated (p(i)%bra)) call abort ()
24         if (associated (p(i)%ket)) call abort ()
25   end do
26 end program