2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pointer_array_6.f90
blob86685563209389a37318afd9084ecd338d2d638f
1 ! { dg-do run }
3 ! Test the fix for PR57019 comment 4 as part of the overall fix for PR34640.
5 ! Contributed by <thambsup@gmail.com>
7 type cParticle
8 real(4) :: v(3)
9 endtype cParticle
11 type pCItem
12 type(cParticle) :: Ele
13 end type pCItem
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.
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)) call abort
25 v_real = 88
26 pArray(1,1)%v = v_real !SEGFAULT %%%%%%%%%%%%%%%%%%%%%%%%
27 if (any (int (v_pointer) .ne. 88)) call abort
28 end