aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/declare-variant-mod-1.f90
blob: b6ed2c755294f91a8668409e1e94c3d9f79f4373 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
! { dg-do link }
! { dg-additional-options "-fdump-tree-gimple" }
! { dg-additional-sources "declare-variant-mod-1-use.f90" }

! Note: We have to use 'link' as otherwise '-o' is specified,
! which does not work with multiple files.

! Check that module-file handling works for declare_variant
! and its match/adjust_args/append_args clauses
!
! PR fortran/115271

! Define to make linker happy
integer function m1_f (x, y, z)
  use iso_c_binding
  type(c_ptr) :: x, y, z
  value :: x
end

integer function m1_g (x, y, z)
  use iso_c_binding
  type(c_ptr) :: x, y, z
  value :: x
end

module m1
  implicit none (type, external)

  interface
    integer function m1_f (x, y, z)
      use iso_c_binding
      type(c_ptr) :: x, y, z
      value :: x
    end
    integer function m1_g (x, y, z)
      !$omp declare variant(m1_f) match(construct={dispatch}) adjust_args(need_device_ptr: x, 3) adjust_args(nothing: y)
      use iso_c_binding
      type(c_ptr) :: x, y, z
      value :: x
    end
  end interface
end module m1

module m2
  implicit none (type, external)
contains
  integer function m2_f (x, y, z)
    use iso_c_binding
    type(c_ptr) :: x, y, z
    value :: x
    m2_f = 1
  end
  integer function m2_g (x, y, z)
    !$omp declare variant(m2_f) match(construct={dispatch}) adjust_args(need_device_ptr: x, 3) adjust_args(nothing: y)
    use iso_c_binding
    type(c_ptr) :: x, y, z
    value :: x
    m2_g = 2
  end
end module m2

module m3_pre
  implicit none (type, external)
contains
  integer function m3_f (x, y, z)
    use iso_c_binding
    type(c_ptr) :: x, y, z
    value :: x
    m3_f = 1
  end
  integer function m3_g (x, y, z)
    use iso_c_binding
    type(c_ptr) :: x, y, z
    value :: x
    m3_g = 2
  end
end module m3_pre

module m3
  use m3_pre, only: my_m3_f => m3_f, my_m3_g => m3_g
  implicit none (type, external)
  !$omp declare variant(my_m3_g : my_m3_f) match(construct={dispatch}) adjust_args(need_device_ptr: 1, 3) adjust_args(nothing: 2)
end module m3