Debian Codegraph @

gcc/testsuite/gfortran.dg/pointer_array_6.f90

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR57019 comment 4 as part of the overall fix for PR34640.
4 !
5 ! Contributed by <[email protected]>
6 !
7 type cParticle
8 real(4) :: v(3)
9 endtype cParticle
10
11 type pCItem
12 type(cParticle) :: Ele
13 end type pCItem
14
15 type(pCItem), target, dimension(1:1,1:1) :: pCellArray
16 type(cParticle), pointer, dimension(:,:) :: pArray
17 real(4), pointer, dimension(:) :: v_pointer
18 real(4), dimension(3) :: v_real = 99.
19
20 pArray => pCellArray%Ele
21 v_pointer => pArray(1,1)%v;
22 v_pointer = v_real !OK %%%%%%%%%%%%
23 if (any (int (pArray(1,1)%v) .ne. 99)) STOP 1
24
25 v_real = 88
26 pArray(1,1)%v = v_real !SEGFAULT %%%%%%%%%%%%%%%%%%%%%%%%
27 if (any (int (v_pointer) .ne. 88)) STOP 2
28 end