------- Comment #3 from kargl at gcc dot gnu dot org  2009-10-15 03:55 -------
(In reply to comment #1)
> Try this patch.  Does it give reasonable results?  Does endianess matter here?
> 
> Index: write.c
> ===================================================================
> --- write.c     (revision 152697)
> +++ write.c     (working copy)
> @@ -392,9 +392,10 @@
>        }
>        break;
>  #ifdef HAVE_GFC_INTEGER_16
> +    case 10:
>      case 16:
>        {
> -       GFC_INTEGER_16 tmp;
> +       GFC_INTEGER_16 tmp = 0;
>         memcpy ((void *) &tmp, p, len);
>         i = tmp;
>        }
> @@ -446,9 +447,10 @@
>        }
>        break;
>  #ifdef HAVE_GFC_INTEGER_16
> +    case 10:
>      case 16:
>        {
> -       GFC_INTEGER_16 tmp;
> +       GFC_INTEGER_16 tmp = 0;
>         memcpy ((void *) &tmp, p, len);
>         i = (GFC_UINTEGER_16) tmp;
>        }
> 

The patch is fine for 64-bit architectures.  On 32-bit architectures
such as i686-*-freebsd the patch fails because there is a REAL(10)
but no INTEGER(16).  Truncating to INTEGER(*) would seem appealing
except that I was specifically interested in the bits on the last 
few bytes. :(


-- 


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

Reply via email to