PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / finalize_10.f90
blob937dff5a1674e0838169f6fcf4a9d50740ec8ec3
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
4 ! PR fortran/37336
6 ! Finalize nonallocatable INTENT(OUT)
8 module m
9 type t
10 end type t
11 type t2
12 contains
13 final :: fini
14 end type t2
15 contains
16 elemental subroutine fini(var)
17 type(t2), intent(inout) :: var
18 end subroutine fini
19 end module m
21 subroutine foo(x,y,aa,bb)
22 use m
23 class(t), intent(out) :: x(:),y
24 type(t2), intent(out) :: aa(:),bb
25 end subroutine foo
27 ! Finalize CLASS + set default init
28 ! { dg-final { scan-tree-dump-times "y->_vptr->_final \\(&desc.\[0-9\]+, y->_vptr->_size, 0\\);" 1 "original" } }
29 ! { dg-final { scan-tree-dump "__builtin_memcpy \\(\\(void .\\) y->_data, \\(void .\\) y->_vptr->_def_init, \\((unsigned long|unsigned int|character\\(kind=4\\))\\) y->_vptr->_size\\);" "original" } }
30 ! { dg-final { scan-tree-dump-times "x->_vptr->_final \\(&parm.\[0-9\]+, x->_vptr->_size, 0\\);" 1 "original" } }
31 ! { dg-final { scan-tree-dump-times "x->_vptr->_copy \\(" 1 "original" } }
33 ! FINALIZE TYPE:
34 ! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void \\*\\) &\\(\\*aa.\[0-9\]+\\)\\\[0\\\];" 1 "original" } }
35 ! { dg-final { scan-tree-dump-times "__final_m_T2 \\(&parm.\[0-9\]+, 0, 0\\);" 1 "original" } }
36 ! { dg-final { scan-tree-dump-times "desc.\[0-9\]+.data = \\(void \\* restrict\\) bb;" 1 "original" } }
37 ! { dg-final { scan-tree-dump-times "__final_m_T2 \\(&desc.\[0-9\]+, 0, 0\\);" 1 "original" } }