public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51842] New: fortran fails if ssize_t is 32-bit on 64-bit host
@ 2012-01-13  3:48 mrs at gcc dot gnu.org
  2012-01-13  9:08 ` [Bug fortran/51842] " jb at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mrs at gcc dot gnu.org @ 2012-01-13  3:48 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-01-13 19:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13  3:48 [Bug fortran/51842] New: fortran fails if ssize_t is 32-bit on 64-bit host mrs at gcc dot gnu.org
2012-01-13  9:08 ` [Bug fortran/51842] " jb at gcc dot gnu.org
2012-01-13  9:31 ` burnus at gcc dot gnu.org
2012-01-13  9:32 ` burnus at gcc dot gnu.org
2012-01-13  9:51 ` burnus at gcc dot gnu.org
2012-01-13 10:26 ` jb at gcc dot gnu.org
2012-01-13 10:38 ` burnus at gcc dot gnu.org
2012-01-13 11:51 ` jb at gcc dot gnu.org
2012-01-13 15:50 ` burnus at gcc dot gnu.org
2012-01-13 17:37 ` mrs at gcc dot gnu.org
2012-01-13 20:18 ` jb at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).