aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/goacc/routine-1.f90
blob: 67c5f11be6a5817714b3cb348dd413cdaff8c790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
! { dg-do compile }

  integer, parameter :: n = 10
  integer :: a(n), i
  integer, external :: fact
  i = 1
  !$acc routine (fact)  ! { dg-error "Unexpected \\\!\\\$ACC ROUTINE" }
  !$acc routine ()  ! { dg-error "Syntax error in \\\!\\\$ACC ROUTINE \\\( NAME \\\)" }
  !$acc parallel
  !$acc loop
  do i = 1, n
     a(i) = fact (i)
     call incr (a(i))
  end do
  !$acc end parallel
  do i = 1, n
     write (*, "(I10)") a(i)
  end do
end
recursive function fact (x) result (res)
  integer, intent(in) :: x
  integer :: res
  res = 1
  !$acc routine  ! { dg-error "Unexpected \\\!\\\$ACC ROUTINE" }
  if (x < 1) then
     res = 1
  else
     res = x * fact (x - 1)
  end if
end function fact
subroutine incr (x)
  integer, intent(inout) :: x
  integer i
  i = 0
  !$acc routine  ! { dg-error "Unexpected \\\!\\\$ACC ROUTINE" }
  x = x + 1
end subroutine incr