| 1 |
! { dg-do compile { target skip-all-targets } } |
| 2 |
! used by declare-variant-mod-1.f90 |
| 3 |
|
| 4 |
! Check that module-file handling works for declare_variant |
| 5 |
! and its match/adjust_args/append_args clauses |
| 6 |
! |
| 7 |
! PR fortran/115271 |
| 8 |
|
| 9 |
subroutine test1 |
| 10 |
use m1 |
| 11 |
use iso_c_binding, only: c_loc, c_ptr |
| 12 |
implicit none (type, external) |
| 13 |
|
| 14 |
integer :: i, j |
| 15 |
type(c_ptr) :: a1, b1, c1, x1, y1, z1 |
| 16 |
|
| 17 |
!$omp dispatch |
| 18 |
i = m1_g (a1, b1, c1) |
| 19 |
j = m1_g (x1, y1, z1) |
| 20 |
end |
| 21 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(c1.\[0-9\]+, D\\.\[0-9\]+\\);" 1 "gimplify" } } |
| 22 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(a1, D\\.\[0-9\]+\\);" 1 "gimplify" } } |
| 23 |
! { dg-final { scan-tree-dump-times "i = m1_f \\(D\\.\[0-9\]+, &b1, &D\\.\[0-9\]+\\);" 1 "gimplify" } } |
| 24 |
! { dg-final { scan-tree-dump-times "j = m1_g \\(x1, &y1, &z1\\);" 1 "gimplify" } } |
| 25 |
|
| 26 |
subroutine test2 |
| 27 |
use m2, only: m2_g |
| 28 |
use iso_c_binding, only: c_loc, c_ptr |
| 29 |
implicit none (type, external) |
| 30 |
|
| 31 |
integer :: i, j |
| 32 |
type(c_ptr) :: a2, b2, c2, x2, y2, z2 |
| 33 |
|
| 34 |
!$omp dispatch |
| 35 |
i = m2_g (a2, b2, c2) |
| 36 |
j = m2_g (x2, y2, z2) |
| 37 |
end |
| 38 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr (c2.\[0-9\]+, D\\.\[0-9\]+);" 1 "gimplify" } } |
| 39 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr (a2, D\\.\[0-9\]+);" 1 "gimplify" } } |
| 40 |
! { dg-final { scan-tree-dump-times "i = m2_f (D\\.\[0-9\]+, &b2, &D\\.\[0-9\]+);" 1 "gimplify" } } |
| 41 |
! { dg-final { scan-tree-dump-times "j = m2_g \\(x2, &y2, &z2\\);" 1 "gimplify" } } |
| 42 |
|
| 43 |
subroutine test3 |
| 44 |
use m2, only: my_func => m2_g |
| 45 |
use iso_c_binding, only: c_loc, c_ptr |
| 46 |
implicit none (type, external) |
| 47 |
|
| 48 |
integer :: i, j |
| 49 |
type(c_ptr) :: a3, b3, c3, x3, y3, z3 |
| 50 |
|
| 51 |
!$omp dispatch |
| 52 |
i = my_func (a3, b3, c3) |
| 53 |
j = my_func (x3, y3, z3) |
| 54 |
end |
| 55 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr (c3.\[0-9\]+, D\\.\[0-9\]+);" 1 "gimplify" } } |
| 56 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr (a3, D\\.\[0-9\]+);" 1 "gimplify" } } |
| 57 |
! { dg-final { scan-tree-dump-times "i = m2_f (D\\.\[0-9\]+, &b3, &D\\.\[0-9\]+);" 1 "gimplify" } } |
| 58 |
! { dg-final { scan-tree-dump-times "j = m2_g \\(x3, &y3, &z3\\);" 1 "gimplify" } } |
| 59 |
|
| 60 |
subroutine test4 |
| 61 |
use m3, only: my_m3_g |
| 62 |
use iso_c_binding, only: c_loc, c_ptr |
| 63 |
implicit none (type, external) |
| 64 |
|
| 65 |
integer :: i, j |
| 66 |
type(c_ptr) :: a4, b4, c4, x4, y4, z4 |
| 67 |
|
| 68 |
!$omp dispatch |
| 69 |
i = my_m3_g (a4, b4, c4) |
| 70 |
j = my_m3_g (x4, y4, z4) |
| 71 |
end |
| 72 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr (c4.\[0-9\]+, D\\.\[0-9\]+);" 1 "gimplify" } } |
| 73 |
! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr (a4, D\\.\[0-9\]+);" 1 "gimplify" } } |
| 74 |
! { dg-final { scan-tree-dump-times "i = m3_f (D\\.\[0-9\]+, &b4, &D\\.\[0-9\]+);" 1 "gimplify" } } |
| 75 |
! { dg-final { scan-tree-dump-times "j = m3_g \\(x4, &y4, &z4\\);" 1 "gimplify" } } |
| 76 |
|
| 77 |
program main |
| 78 |
call test1 |
| 79 |
call test2 |
| 80 |
call test3 |
| 81 |
end |