PR c/29467
[official-gcc.git] / gcc / testsuite / gfortran.dg / nullify_3.f90
blob7d202a25893ef20f7cb90c7a7ee3585691fd1a13
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.
7 ! Contributed by Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
9 program test
10 implicit none
11 type projector_t
12 real, pointer :: ket(:, :), bra(:, :)
13 end type projector_t
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