1! { dg-do compile }
2! { dg-additional-options "-fdump-tree-gimple" }
3
4! Test that 'declare variant' works when applied to an external subroutine
5
6module main
7  implicit none
8
9  interface
10    subroutine base ()
11      !$omp declare variant (variant) match (construct={parallel})
12    end subroutine
13
14    subroutine base2 ()
15      !$omp declare variant (base2: variant2) match (construct={target})
16    end subroutine
17  end interface
18contains
19  subroutine variant ()
20  end subroutine
21
22  subroutine variant2 ()
23  end subroutine
24
25  subroutine test ()
26    !$omp parallel
27      call base ()  ! { dg-final { scan-tree-dump-times "variant \\\(\\\);" 1 "gimple" } }
28    !$omp end parallel
29  end subroutine
30
31  subroutine test2 ()
32    !$omp target
33      call base2 ()  ! { dg-final { scan-tree-dump-times "variant2 \\\(\\\);" 1 "gimple" } }
34    !$omp end target
35  end subroutine
36end module
37