1! { dg-do compile }
2! Tests the fix for PR30876 in which interface derived types were
3! not always being associated.
4!
5! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
6!
7MODULE M1
8CONTAINS
9 FUNCTION correct_input(i)
10   INTEGER :: i,correct_input(5), ans(5) = 0
11   IF (i<1) correct_input=test(1)
12   IF (i>5) correct_input=test(5)
13 END FUNCTION correct_input
14
15 RECURSIVE FUNCTION test(i)
16  INTEGER :: test(5),i,j
17  IF (i<1 .OR. i>5) THEN
18    test=correct_input(i)
19  ELSE
20    test=0
21    test(1:6-i)=(/(j,j=i,5)/)
22    test=test(3)
23  ENDIF
24 END FUNCTION
25
26END MODULE M1
27
28USE M1
29integer :: ans(5)
30IF (ANY(TEST(3).NE.(/5,5,5,5,5/))) CALL ABORT()
31IF (ANY(TEST(6).NE.(/0,0,0,0,0/))) CALL ABORT()
32END
33