1! { dg-do run }
2! Tests the fix for PR32665 in which the structure initializer at line
3! 13 was getting the array length wrong by one and in which the automatic
4! deallocation of a in 14 was occurring before the evaluation of the rhs.
5!
6! Contributed by Daniel Franke <dfranke@gcc.gnu.org>
7!
8  TYPE :: x
9    INTEGER, ALLOCATABLE :: a(:)
10  END TYPE
11  TYPE(x) :: a
12
13  a = x ((/ 1, 2, 3 /))                             ! This is also pr31320.
14  a = x ((/ a%a, 4 /))
15  if (any (a%a .ne. (/1,2,3,4/))) call abort ()
16end
17