OSDN Git Service

2011-09-26 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / move_alloc_2.f90
1 ! { dg-do run }
2 !
3 ! PR 45004: [OOP] Segfault with allocatable scalars and move_alloc
4 !
5 ! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
6
7 program bug18
8
9   type foo
10     integer :: i
11   end type foo
12
13   type bar
14     class(foo), allocatable :: bf
15   end type bar
16
17   class(foo), allocatable :: afab
18   type(bar) :: bb
19
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()
26
27 end program bug18