1! { dg-do run }
2!
3! PR fortran/57798
4! The call to sum used to be inlined into a loop with an uninitialized bound
5!
6! Original testcase by Stephan Kramer <stephan.kramer@imperial.ac.uk>
7
8program test
9  implicit none
10
11  call sub(2, 11)
12
13  contains
14
15    function func(m, n)
16      integer, intent(in):: m,n
17      real, dimension(m, n):: func
18
19      func = 1.0
20
21    end function func
22
23    subroutine sub(m, n)
24      integer, intent(in):: m, n
25      real, dimension(m,n):: y
26
27      y = 1.0
28      if (any(sum(y*func(m,n), dim=1) /= m)) call abort
29
30    end subroutine sub
31
32end program test
33
34