4 ! Test the handling of optional, polymorphic and non-polymorphic arguments
5 ! to elemental procedures.
7 ! Original testcase by Tobias Burnus <burnus@net-b.de>
15 integer, allocatable :: a
16 integer, allocatable :: a2(:)
17 integer, pointer :: p => null()
18 integer, pointer :: p2(:) => null()
21 type(t), allocatable :: ta, taa(:)
22 type(t), pointer :: tp, tpa(:)
23 class(t), allocatable :: ca, caa(:)
24 class(t), pointer :: cp, cpa(:)
35 ! =============== sub1 ==================
36 ! SCALAR COMPONENTS: Non alloc/assoc
41 call sub1 (s, x%a, .false.)
42 call sub1 (v, x%a, .false.)
44 if (s /= 3) call abort()
45 if (any (v /= [9, 33])) call abort()
47 call sub1 (s, x%p, .false.)
48 call sub1 (v, x%p, .false.)
50 if (s /= 3) call abort()
51 if (any (v /= [9, 33])) call abort()
54 ! SCALAR COMPONENTS: alloc/assoc
59 call sub1 (s, x%a, .true.)
60 call sub1 (v, x%a, .true.)
62 if (s /= 4*2) call abort()
63 if (any (v /= [4*2, 4*2])) call abort()
65 call sub1 (s, x%p, .true.)
66 call sub1 (v, x%p, .true.)
68 if (s /= 5*2) call abort()
69 if (any (v /= [5*2, 5*2])) call abort()
75 elemental subroutine sub1 (x, y, alloc)
76 integer, intent(inout) :: x
77 integer, intent(in), optional :: y
78 logical, intent(in) :: alloc
79 if (alloc .neqv. present (y)) &