From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 816 invoked by alias); 15 Oct 2009 03:55:27 -0000 Received: (qmail 777 invoked by uid 48); 15 Oct 2009 03:55:16 -0000 Date: Thu, 15 Oct 2009 03:55:00 -0000 Message-ID: <20091015035516.776.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/41711] Z format does not support writing KIND=10 reals In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "kargl at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01256.txt.bz2 ------- 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