1! Valid usage of 'external' procedures with OpenACC 'routine' directives.
2
3! { dg-additional-options "-fdump-tree-optimized-raw" }
4
5  subroutine test (x)
6    implicit none
7    integer, intent(inout) :: x
8    !$acc routine (test)
9
10    integer, external :: f_1
11    !$acc routine (f_1)
12
13    integer f_2 ! No explicit EXTERNAL attribute.
14    !$acc routine (f_2)
15
16    external s_1
17    !$acc routine (s_1)
18
19    ! 's_2' will be an external subroutine without explicit EXTERNAL
20    ! attribute, but we don't have a handle for it yet...
21    !!$acc routine (s_2) ..., so can't specify this, here.
22
23    if (x < 1) then
24       x = 1
25    else
26       x = x * x - 1 + f_1(f_2(x))
27       call s_1(x)
28       call s_2(x)
29    end if
30  end subroutine test
31
32! { dg-final { scan-tree-dump-times "gimple_call" 4 "optimized" } }
33! { dg-final { scan-tree-dump-times "gimple_call <f_1," 1 "optimized" } }
34! { dg-final { scan-tree-dump-times "gimple_call <f_2," 1 "optimized" } }
35! { dg-final { scan-tree-dump-times "gimple_call <s_1," 1 "optimized" } }
36! { dg-final { scan-tree-dump-times "gimple_call <s_2," 1 "optimized" } }
37