2 ! { dg-additional-sources test_c_assoc.c }
4 use, intrinsic :: iso_c_binding
9 function test_c_assoc_0(my_c_ptr
) bind(c
)
10 use, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_associated
11 integer(c_int
) :: test_c_assoc_0
12 type(c_ptr
), value
:: my_c_ptr
14 if(c_associated(my_c_ptr
)) then
19 end function test_c_assoc_0
21 function test_c_assoc_1(my_c_ptr_1
, my_c_ptr_2
) bind(c
)
22 use, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_associated
23 integer(c_int
) :: test_c_assoc_1
24 type(c_ptr
), value
:: my_c_ptr_1
25 type(c_ptr
), value
:: my_c_ptr_2
27 if(c_associated(my_c_ptr_1
, my_c_ptr_2
)) then
32 end function test_c_assoc_1
34 function test_c_assoc_2(my_c_ptr_1
, my_c_ptr_2
, num_ptrs
) bind(c
)
35 integer(c_int
) :: test_c_assoc_2
36 type(c_ptr
), value
:: my_c_ptr_1
37 type(c_ptr
), value
:: my_c_ptr_2
38 integer(c_int
), value
:: num_ptrs
40 if(num_ptrs
.eq
. 1) then
41 if(c_associated(my_c_ptr_1
)) then
47 if(c_associated(my_c_ptr_1
, my_c_ptr_2
)) then
53 end function test_c_assoc_2
55 subroutine verify_assoc(my_c_ptr_1
, my_c_ptr_2
) bind(c
)
56 type(c_ptr
), value
:: my_c_ptr_1
57 type(c_ptr
), value
:: my_c_ptr_2
59 if(.not
. c_associated(my_c_ptr_1
)) then
61 else if(.not
. c_associated(my_c_ptr_2
)) then
63 else if(.not
. c_associated(my_c_ptr_1
, my_c_ptr_2
)) then
66 end subroutine verify_assoc