fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_memcpy_5.f90
blob40fb6957a0dd10de5b38bfbe40e50e3ebf2cf9c6
1 ! { dg-do run }
2 ! Tests the fix for PR33370, in which array copying, with subreferences
3 ! was broken due to a regression.
5 ! Reported by Thomas Koenig <tkoenig@gcc.gnu.org>
7 program main
8 type foo
9 integer :: i
10 character(len=3) :: c
11 end type foo
12 type(foo), dimension(2) :: a = (/foo (1, "uvw"), foo (2, "xyz")/)
13 type(foo), dimension(2) :: b = (/foo (101, "abc"), foo (102, "def")/)
14 a%i = 0
15 print *, a
16 a%i = (/ 12, 2/)
17 if (any (a%c .ne. (/"uvw", "xyz"/))) call abort ()
18 if (any (a%i .ne. (/12, 2/))) call abort ()
19 a%i = b%i
20 if (any (a%c .ne. (/"uvw", "xyz"/))) call abort ()
21 if (any (a%i .ne. (/101, 102/))) call abort ()
22 end program main