| 1 |
! { dg-do compile } |
| 2 |
|
| 3 |
integer, parameter :: n = 10 |
| 4 |
integer :: a(n), i |
| 5 |
integer, external :: fact |
| 6 |
i = 1 |
| 7 |
!$acc routine (fact) ! { dg-error "Unexpected \\\!\\\$ACC ROUTINE" } |
| 8 |
!$acc routine () ! { dg-error "Syntax error in \\\!\\\$ACC ROUTINE \\\( NAME \\\)" } |
| 9 |
!$acc parallel |
| 10 |
!$acc loop |
| 11 |
do i = 1, n |
| 12 |
a(i) = fact (i) |
| 13 |
call incr (a(i)) |
| 14 |
end do |
| 15 |
!$acc end parallel |
| 16 |
do i = 1, n |
| 17 |
write (*, "(I10)") a(i) |
| 18 |
end do |
| 19 |
end |
| 20 |
recursive function fact (x) result (res) |
| 21 |
integer, intent(in) :: x |
| 22 |
integer :: res |
| 23 |
res = 1 |
| 24 |
!$acc routine ! { dg-error "Unexpected \\\!\\\$ACC ROUTINE" } |
| 25 |
if (x < 1) then |
| 26 |
res = 1 |
| 27 |
else |
| 28 |
res = x * fact (x - 1) |
| 29 |
end if |
| 30 |
end function fact |
| 31 |
subroutine incr (x) |
| 32 |
integer, intent(inout) :: x |
| 33 |
integer i |
| 34 |
i = 0 |
| 35 |
!$acc routine ! { dg-error "Unexpected \\\!\\\$ACC ROUTINE" } |
| 36 |
x = x + 1 |
| 37 |
end subroutine incr |