1! { dg-do run }
2! Tests the fix for PR33370, in which array copying, with subreferences
3! was broken due to a regression.
4!
5! Reported by Thomas Koenig <tkoenig@gcc.gnu.org>
6!
7program 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 ()
22end program main
23