Debian Codegraph @

gcc/testsuite/gfortran.dg/move_alloc_19.f90

raw
1 !{ dg-do run }
2
3 ! Check PR 116292 is fixed.
4
5 ! Contributed by Harald Anlauf <[email protected]>
6 ! Sam James <[email protected]>
7
8 program move_alloc_19
9 character, allocatable :: buffer, dummy, dummy2
10 class(*), allocatable :: poly
11
12 dummy = 'C'
13 dummy2 = 'A'
14 call s()
15 if (allocated (dummy)) stop 1
16 if (allocated (dummy2)) stop 2
17 if (.not. allocated (buffer)) stop 3
18 if (.not. allocated (poly)) stop 4
19 if (buffer /= 'C') stop 5
20 select type (poly)
21 type is (character(*))
22 if (poly /= 'A') stop 6
23 if (len (poly) /= 1) stop 7
24 class default
25 stop 8
26 end select
27 deallocate (poly, buffer)
28 contains
29 subroutine s
30 call move_alloc (dummy, buffer)
31 call move_alloc (dummy2, poly)
32 end
33 end
34