Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/adjust-args-12.f90

raw
1 ! { dg-additional-options "-fdump-tree-gimple" }
2
3 ! PR fortran/118321
4
5 ! Ensure that hidden arguments (return by reference) do not mess up the
6 ! argument counting of need_device_ptr
7
8 ! Here, we want to process the 3rd argument: 'c' as dummy argument = 'y' as actual.
9
10
11 ! { dg-final { scan-tree-dump-times "__builtin_omp_get_mapped_ptr" 1 "gimple" } }
12 ! { dg-final { scan-tree-dump "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(y, D\.\[0-9\]+\\);" "gimple" } }
13
14 ! { dg-final { scan-tree-dump "ffff \\(&pstr.\[0-9\], &slen.\[0-9\], &\"abc\"\\\[1\\\]\{lb: 1 sz: 1\}, x, D\.\[0-9\]+, z, &\"cde\"\\\[1\\\]\{lb: 1 sz: 1\}, 3, 3\\);" "gimple" } }
15
16 module m
17 use iso_c_binding
18 implicit none (type, external)
19 contains
20 character(:) function ffff (a,b,c,d,e)
21 allocatable :: ffff
22 character(*) :: a, e
23 type(c_ptr), value :: b,c,d
24 end
25 character(:) function gggg (a,b,c,d,e)
26 !$omp declare variant(ffff) match(construct={dispatch}) &
27 !$omp& adjust_args(need_device_ptr : c)
28 allocatable :: gggg
29 character(*) :: a, e
30 type(c_ptr), value :: b,c,d
31 end
32 end module m
33
34 use m
35 implicit none (type, external)
36 type(c_ptr) :: x,y,z
37 character(len=:), allocatable :: str
38 !$omp dispatch
39 str = gggg ("abc", x, y, z, "cde")
40 end