aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/alloc_comp_assign_11.f90
blob: 2d2b85b841f652755698e3869290f3f651e542a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
! { dg-do run }
!
! PR fortran/49324
!
! Check that with array constructors a deep copy is done
!
implicit none
type t
  integer, allocatable :: A(:)
end type t

type(t) :: x, y
type(t), allocatable :: z(:), z2(:)

allocate (x%A(2))
allocate (y%A(1))
x%A(:) = 11
y%A(:) = 22

allocate (z(2))

z = [ x, y ]
!print *, z(1)%a, z(2)%a, x%A, y%A
if (any (z(1)%a /= 11) .or. z(2)%a(1) /= 22 .or. any (x%A /= 11)  &
    .or. y%A(1) /= 22)  &
  call abort()

x%A(:) = 444
y%A(:) = 555

!print *, z(1)%a, z(2)%a, x%A, y%A
if (any (z(1)%a /= 11) .or. z(2)%a(1) /= 22 .or. any (x%A /= 444)  &
    .or. y%A(1) /= 555)  &
  call abort()

z(:) = [ x, y ]
!print *, z(1)%a, z(2)%a, x%A, y%A
if (any (z(1)%a /= 444) .or. z(2)%a(1) /= 555 .or. any (x%A /= 444)  &
    .or. y%A(1) /= 555)  &
  call abort()
end