1! { dg-do run } 2! { dg-options "-ff2c" } 3! Verifies that array results work with -ff2c 4! try all permutations of result clause in function yes/no 5! and result clause in interface yes/no 6! this is not possible in Fortran 77, but this exercises a previously 7! buggy codepath 8function c() result (r) 9 complex :: r(5) 10 r = 0. 11end function c 12 13function d() 14 complex :: d(5) 15 d = 1. 16end function d 17 18subroutine test_without_result 19interface 20 function c () 21 complex :: c(5) 22 end function c 23end interface 24interface 25 function d () 26 complex :: d(5) 27 end function d 28end interface 29complex z(5) 30z = c() 31if (any(z /= 0.)) call abort () 32z = d() 33if (any(z /= 1.)) call abort () 34end subroutine test_without_result 35 36subroutine test_with_result 37interface 38 function c () result(r) 39 complex :: r(5) 40 end function c 41end interface 42interface 43 function d () result(r) 44 complex :: r(5) 45 end function d 46end interface 47complex z(5) 48z = c() 49if (any(z /= 0.)) call abort () 50z = d() 51if (any(z /= 1.)) call abort () 52end subroutine test_with_result 53 54call test_without_result 55call test_with_result 56end 57 58