2 ! { dg-options "-O2 -fdump-tree-original" }
4 ! PR fortran/32600 c_f_pointer w/o shape
5 ! PR fortran/32580 c_f_procpointer
7 ! Verify that c_f_prointer [w/o shape] and c_f_procpointer generate
8 ! the right code - and no library call
14 type(c_funptr
) :: cfunptr
15 integer(4), pointer :: fptr
16 integer(4), pointer :: fptr_array(:)
17 procedure(integer(4)), pointer :: fprocptr
19 call c_f_pointer(cptr
, fptr
)
20 call c_f_pointer(cptr
, fptr_array
, [ 1 ])
21 call c_f_procpointer(cfunptr
, fprocptr
)
24 ! Make sure there is no function call:
25 ! { dg-final { scan-tree-dump-times "c_f" 0 "original" } }
26 ! { dg-final { scan-tree-dump-times "c_f_pointer" 0 "original" } }
27 ! { dg-final { scan-tree-dump-times "c_f_pointer_i4" 0 "original" } }
29 ! Check scalar c_f_pointer
30 ! { dg-final { scan-tree-dump-times " fptr = .integer.kind=4. .. cptr" 1 "original" } }
34 ! { dg-final { scan-tree-dump-times " fptr_array.data = cptr;" 1 "original" } }
35 ! { dg-final { scan-tree-dump-times " fptr_array.dim\\\[S..\\\].lbound = 1;" 1 "original" } }
36 ! { dg-final { scan-tree-dump-times " fptr_array.dim\\\[S..\\\].ubound = " 1 "original" } }
37 ! { dg-final { scan-tree-dump-times " fptr_array.dim\\\[S..\\\].stride = " 1 "original" } }
39 ! Check c_f_procpointer
40 ! { dg-final { scan-tree-dump-times " fprocptr = .integer.kind=4. .\\*<.*>. ... cfunptr;" 1 "original" } }
42 ! { dg-final { cleanup-tree-dump "original" } }