2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / move_alloc_2.f90
blob5dabca849db17f1192ab2937cbe970ee38b19814
1 ! { dg-do run }
3 ! PR 45004: [OOP] Segfault with allocatable scalars and move_alloc
5 ! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
7 program bug18
9 type foo
10 integer :: i
11 end type foo
13 type bar
14 class(foo), allocatable :: bf
15 end type bar
17 class(foo), allocatable :: afab
18 type(bar) :: bb
20 allocate(foo :: afab)
21 afab%i = 8
22 call move_alloc(afab, bb%bf)
23 if (.not. allocated(bb%bf)) call abort()
24 if (allocated(afab)) call abort()
25 if (bb%bf%i/=8) call abort()
27 end program bug18