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"
8 character(kind
=c_char
,len
=1),parameter :: str2(4) = ["a","b","c","d"]
10 integer(c_intptr_t
) :: iptr
12 ! Using F2008's C_SIZEOF
14 if (i
/= 4) call abort()
17 if (i
/= 40) call abort()
20 if (i
/= 4) call abort()
23 if (i
/= 1) call abort()
25 write(*,*) c_sizeof(cptr
), c_sizeof(iptr
), c_sizeof(C_NULL_PTR
)
29 if (i
/= 4) call abort()
32 if (i
/= 40) call abort()
35 if (i
/= 4) call abort()
38 if (i
/= 4) call abort()
40 i
= sizeof(str(1)(1:3))
41 if (i
/= 3) call abort()