This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR25289 Cannot handle record numbers large than huge(0_4)


Janne Blomqvist wrote:
On Mon, Jun 19, 2006 at 01:13:39PM +0200, François-Xavier Coudert wrote:

The patch converts the record number used for direct I/O to type gfc_offset in
the library and on the front end changes the type to int8 to match.

A gfc_offset is an off_t, which might not always be an int8.

The current situation is for the front-end to use
/* Choose the integer kind the same size as "void*" for our index kind. */
gfc_index_integer_kind = POINTER_SIZE / 8;
which means supposing that an off_t is always the same as a (void *).
I don't know if that assumption is right...

It's incorrect. E.g. off_t is 64 bits on systems with large file
support, even though they may have a 32 bit void*.

This is an interesting discussion.

First, yes this is an ABI change so I will only commit to 4.2 when approved.

Second ...

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.

Looking in types.h, off_t is defined depending on features.h which defines __USE_FILE_OFFSET64. Without digging further I am guessing that off_t on the frontend side is defined elsewhere or __USE_FILE_OFFSET64 is not defined.

Is this difference a bug?

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?

The following is an extract from types.h:

#ifndef __off_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
# else
typedef __off64_t off_t;
# endif
# define __off_t_defined
#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
typedef __off64_t off64_t;
# define __off64_t_defined

Is __USE_LARGEFILE64 defined in all cases?

If not should I put some conditional compile directives both on library side and front end side to assure the sizes match?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]