------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-05-22 05:01 
-------
The following simplistic patch solves this problem.  Sometimes I think we get
overzealous with definitions and fancy configury.  We all know the size is 10
bytes and 12 works.

This works:

Index: size_from_kind.c
===================================================================
--- size_from_kind.c    (revision 124927)
+++ size_from_kind.c    (working copy)
@@ -50,7 +50,7 @@ size_from_real_kind (int kind)
 #endif
 #ifdef HAVE_GFC_REAL_10
     case 10:
-      return sizeof (GFC_REAL_10);
+      return (sizeof (GFC_REAL_4) + sizeof (GFC_REAL_8));
 #endif
 #ifdef HAVE_GFC_REAL_16
     case 16:

In the file mk-kinds-h.sh we have the following snippet:

      4) ctype="float" ;;
      8) ctype="double" ;;
      10) ctype="long double" ;;
      16) ctype="long double" ;;
      *) echo "$0: Unknown type" >&2 ; exit 1 ;;

All fine and dandy, except in the library we don't want a ctype, we want the
size of a real kind=10 (which I think really ought to be 10, not 12)

I don't think there is an equivalent ctype.  At least not for writing bytes to
a file.

I am not sure why we don't just do this:

size_from_real_kind (int kind)
{
       return kind;
}

It would probably work.  Which implies maybe we could do without this function
altogether.  Isn't the implementation of  kind up to the compiler and it could
equal kind if we so choose? (with respect to unformatted I/O, why write more
bytes than needed?)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31933

Reply via email to