This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51842] New: fortran fails if ssize_t is 32-bit on 64-bit host
- From: "mrs at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 13 Jan 2012 03:47:56 +0000
- Subject: [Bug fortran/51842] New: fortran fails if ssize_t is 32-bit on 64-bit host
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51842
Bug #: 51842
Summary: fortran fails if ssize_t is 32-bit on 64-bit host
Classification: Unclassified
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mrs@gcc.gnu.org
fortran fails if ssize_t is 32-bits on a 64-bit (LP64) host. The runtime and
codegen disagree over the size of fields. Either, the codegen should match the
runtime, or the runtime should match the codegen.
>From libgfortran.h:
/* The following two definitions must be consistent with the types used
by the compiler. */
/* The type used of array indices, amongst other things. */
typedef ssize_t index_type;
typedef struct descriptor_dimension
{
index_type _stride;
index_type _lbound;
index_type _ubound;
}
descriptor_dimension;
#define GFC_ARRAY_DESCRIPTOR(r, type) \
struct {\
type *data;\
size_t offset;\
index_type dtype;\
descriptor_dimension dim[r];\
}
is but one example of a mismatch. Better to use size_t, or ptrdiff_t
uniformly, if you want a 64-bit type on a 64-bit pointer host.
Tracking this problem down, was, very annoying. I fixed my port to use a
64-bit type for ssize_t (bad port), so, I'm fine now. For the next person, you
might want to assert that sizeof (size_t) == sizeof (ssize_t), so they can at
least find the problem faster if you don't `fix it'.
Thanks.