In libgfortran you can see that gfc_offset is defined in terms of
off_t and it is 64 bits there. However, at the point of interest in
trans-io.c, off_t is int4 and not int8.
I found this out trying gfc_get_int_type (sizeof(off_t)) which fails
miserably and in -fdump-tree-original you can see that rec is assigned
(int4) n, with the int4 cast.
[...]
> If I use gfc_get_int_type (sizeof(off64_t)) all appears to work fine.
> Is it safe to assume off64_t is defined for all targets of interest?
You cannot do that kind of things anyhow, because the host off64_t
(which will be used when the front-end is compiled) might not have the
same size as the target off64_t (which will be used for the library). On
that topic, you can e.g. read the thread that lead to
http://gcc.gnu.org/ml/fortran/2005-12/msg00136.html According to Richard
Henderson, that problem is solvable
(http://gcc.gnu.org/ml/fortran/2005-12/msg00142.html), but I'm not sure
if he's in possession of a constructive proof of existence ;-)