This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51842] fortran fails if ssize_t is 32-bit on 64-bit host
- From: "burnus 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 10:34:01 +0000
- Subject: [Bug fortran/51842] fortran fails if ssize_t is 32-bit on 64-bit host
- Auto-submitted: auto-generated
- References: <bug-51842-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51842
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-13 10:34:01 UTC ---
(In reply to comment #5)
> Yes, and no. It is perhaps a better match for the current frontend logic of
> choosing a type equal to the pointer size, but semantically ptrdiff_t is the
> better choice for array indexing.
OK. But then the logical step is to change the FE - how about something like
the following?
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -576,10 +576,7 @@ gfc_init_kinds (void)
gfc_default_character_kind = gfc_character_kinds[0].kind;
gfc_character_storage_size = gfc_default_character_kind * 8;
- /* Choose the integer kind the same size as "void*" for our index kind. */
- gfc_index_integer_kind = POINTER_SIZE / 8;
- /* Pick a kind the same size as the C "int" type. */
- gfc_c_int_kind = INT_TYPE_SIZE / 8;
+ gfc_index_integer_kind = get_int_kind_from_name (PTRDIFF_TYPE);
/* Choose atomic kinds to match C's int. */
gfc_atomic_int_kind = gfc_c_int_kind;