2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / alloc_comp_constructor_4.f90
blob4b047daf3490ac6a9b37e24edd5bb998646a7d2b
1 ! { dg-do run }
2 ! Tests the fix for PR32795, which was primarily about memory leakage is
3 ! certain combinations of alloctable components and constructors. This test
4 ! which appears in comment #2 of the PR has the advantage of a wrong
5 ! numeric result which is symptomatic.
7 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
9 type :: a
10 integer, allocatable :: i(:)
11 end type a
12 type(a) :: x, y
13 x = a ([1, 2, 3])
14 y = a (x%i(:)) ! used to cause a memory leak and wrong result
15 if (any (x%i .ne. [1, 2, 3])) call abort
16 end