Debian Codegraph @

gcc/testsuite/gfortran.dg/nullify_3.f90

raw
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 <[email protected]>
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)) STOP 1
24 if (associated (p(i)%ket)) STOP 2
25 end do
26 end program