aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/nullify_3.f90
blob: 7d202a25893ef20f7cb90c7a7ee3585691fd1a13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
! { dg-do run }
! { dg-options "-O0 -fbounds-check" }
! Tests patch for PR29371, in which the null pointer
! assignment would cause a segfault with the bounds
! check on.
!
! Contributed by Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
!
program test
  implicit none
  type projector_t
    real,   pointer :: ket(:, :), bra(:, :)
  end type projector_t

  type(projector_t),pointer, dimension(:) :: p
  integer :: stat,i
  allocate(p(2),stat=stat)
  do i = 1, 2
        nullify(p(i)%bra)
        nullify(p(i)%ket)
  end do
  do i = 1, 2
        if (associated (p(i)%bra)) call abort ()
        if (associated (p(i)%ket)) call abort ()
  end do
end program