aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/unlimited_polymorphic_5.f90
blob: 12a3c4a5624733dbe717a4e93d14e4dd62b13bb2 (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/55763
!
! Based on Reinhold Bader's test case
!

program mvall_03
  implicit none
  integer, parameter :: n1 = 100, n2 = 200
  class(*), allocatable :: i1(:), i3(:)
  integer, allocatable :: i2(:)

  allocate(real :: i1(n1))
  allocate(i2(n2))
  i2 = 2
  call move_alloc(i2, i1)
  if (size(i1) /= n2 .or. allocated(i2)) then
    call abort
!   write(*,*) 'FAIL'
  else
!    write(*,*) 'OK'
  end if

  select type (i1)
    type is (integer)
      if (any (i1 /= 2)) call abort
    class default
      call abort()
  end select
  call move_alloc (i1, i3)
  if (size(i3) /= n2 .or. allocated(i1)) then
    call abort()
  end if
  select type (i3)
    type is (integer)
      if (any (i3 /= 2)) call abort
    class default
      call abort()
  end select
end program