3 ! Test the fix for PR57284 - [OOP] ICE with find_array_spec for polymorphic
4 ! arrays. Once thw ICE was fixed, work was needed to fix a segfault while
5 ! determining the size of 'z'.
7 ! Contributed by Lorenz Huedepohl <bugs@stellardeath.org>
14 type(type_t), allocatable :: cmp(:)
17 function foo(a, b) result(add)
18 class(type_t), intent(in) :: a(:), b(size(a))
19 type(type_t) :: add(size(a))
20 add%idx = a%idx + b%idx
25 class(type_t), allocatable, dimension(:) :: x, y, z
26 class(type_u), allocatable :: w
27 allocate (x, y, source = [type_t (1), type_t(2)])
29 if (any (z%idx .ne. [2, 4])) stop 1
31 ! Try something a bit more complicated than the original.
34 allocate (w%cmp, source = [type_t (2), type_t(3)])
36 if (any (z%idx .ne. [3, 5])) stop 2
37 deallocate (w, x, y, z)