2 ! { dg-options "-fdump-tree-original" }
4 ! Test the fix for PR83567 in which the parameterized component 'foo' was
5 ! being deallocated before return from 'addw', with consequent segfault in
8 ! Contributed by Berke Durak <berke.durak@gmail.com>
9 ! The function 'addvv' has been made elemental so that the test can check that
10 ! arrays are correctly treated and that no memory leaks occur.
16 integer :: foo(k)=[1,2,3]
19 elemental function addvv(a,b) result(c)
20 type(vec(k=*)), intent(in) :: a
21 type(vec(k=*)), intent(in) :: b
31 type(vec) :: u,v,w, a(2), b(2), c(2)
37 if (any (w%foo .ne. [3,5,7])) STOP 1
43 if (any (c(1)%foo .ne. [13,15,17])) STOP 2
45 ! { dg-final { scan-tree-dump-times "__builtin_free" 8 "original" } }
46 ! { dg-final { scan-tree-dump-times "__builtin_malloc" 9 "original" } }