view gcc/testsuite/gfortran.dg/array_function_1.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
! PR fortran/30720
program array_function_1
  integer :: a(5), b, l, u
  l = 4
  u = 2

  a = (/ 1, 2, 3, 4, 5 /)

  b = f(a(l:u) - 2)
  if (b /= 0) STOP 1

  b = f(a(4:2) - 2)
  if (b /= 0) STOP 2

  b = f(a(u:l) - 2)
  if (b /= 3) STOP 3

  b = f(a(2:4) - 2)
  if (b /= 3) STOP 4

  contains
    integer function f(x)
      integer, dimension(:), intent(in) :: x
      f = sum(x)
    end function
end program