Debian Codegraph @

gcc/testsuite/gfortran.dg/allocatable_char_1.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-fdump-tree-original" }
3 !
4 ! PR fortran/59252
5
6 module mod
7 implicit none
8
9 type t1
10 character(256), allocatable :: label
11 end type t1
12
13 type t2
14 type(t1), allocatable :: appv(:)
15 end type t2
16
17 contains
18 subroutine construct(res)
19 type(t2), allocatable, intent(inout) :: res
20 if (.not. allocated(res)) allocate(res)
21 end subroutine construct
22
23 subroutine construct_appv(appv)
24 type(t1), allocatable, intent(inout) :: appv(:)
25 if (.not. allocated(appv)) allocate(appv(20))
26 end subroutine construct_appv
27
28 type(t1) function foo () result (res)
29 end function foo
30 end module mod
31
32 program testy
33 use mod
34 implicit none
35 type(t2), allocatable :: res
36 type(t1) :: s
37
38 ! original test from pr59252
39 call construct (res)
40 call construct_appv(res%appv)
41 deallocate (res)
42
43 ! related test from pr118747 comment 2:
44 s = foo ()
45 end program testy
46
47 ! { dg-final { scan-tree-dump-not "__builtin_memmove" "original" } }