2 ! Support F2008's c_sizeof()
4 use iso_c_binding
, only
: c_int
, c_char
, c_ptr
, c_intptr_t
, c_null_ptr
, c_sizeof
6 integer(kind
=c_int
) :: i
, j(10)
7 character(kind
=c_char
,len
=4),parameter :: str(1) = "abcd"
9 integer(c_intptr_t
) :: iptr
11 ! Using F2008's C_SIZEOF
13 if (i
/= 4) call abort()
16 if (i
/= 40) call abort()
19 if (i
/= 4) call abort()
22 if (i
/= 4) call abort()
24 i
= c_sizeof(str(1)(1:3))
25 if (i
/= 3) call abort()
27 write(*,*) c_sizeof(cptr
), c_sizeof(iptr
), c_sizeof(C_NULL_PTR
)
31 if (i
/= 4) call abort()
34 if (i
/= 40) call abort()
37 if (i
/= 4) call abort()
40 if (i
/= 4) call abort()
42 i
= sizeof(str(1)(1:3))
43 if (i
/= 3) call abort()