> type, bind(C) :: descr
> type(C_PTR) address
> integer(C_INTPTR_T) unknown1
> integer(C_INTPTR_T) unknown2
> integer(C_INTPTR_T) stride
> integer(C_INTPTR_T) unknown3
> integer(C_INTPTR_T) last_element
> end type descr
No, these are not the types I indicated.
> So it seems that the structure constructor for type(descr) isn't
> assigning that first member, address.
I got to the following reduced testcase:
$ cat a.f90
program main
use ISO_C_BINDING
implicit none
type, bind(C) :: descr
type(C_PTR) :: address
end type descr
type(descr) :: DD
double precision, target :: buf(1)
buf = (/ 0 /)
DD = descr(c_loc(buf))
print *, transfer(DD%address, 0_c_intptr_t), &
transfer(c_loc (buf), 0_c_intptr_t)
end program main
$ gfortran a.f90 && ./a.out
0 -1073744200
where both gfortran and g95 give weird results (Sun doesn't want to
compile it, for some reason I don't understand).
--
FX


|