This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/18710] img part of complex number not written to direct access file
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Nov 2004 23:38:52 -0000
- Subject: [Bug libfortran/18710] img part of complex number not written to direct access file
- References: <20041129001627.18710.bdavis@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tobi at gcc dot gnu dot org 2004-11-29 23:38 -------
This patch fixes it and passes the testsuite, but I'd like someone to test that
it doesn't break anything else (I don't think it will, but then I don't know the
standard's semantics for unformatted transfers)
2004-11-30 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/18710
* io/transfer.c (unformatted_read, unformatted_write): width of
a COMPLEX is twice its kind.
Index: libgfortran/io/transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/transfer.c,v
retrieving revision 1.17
diff -u -p -r1.17 transfer.c
--- libgfortran/io/transfer.c 7 Oct 2004 21:30:50 -0000 1.17
+++ libgfortran/io/transfer.c 29 Nov 2004 23:33:11 -0000
@@ -271,6 +271,10 @@ unformatted_read (bt type, void *dest, i
{
void *source;
int w;
+
+ if (type == BT_COMPLEX)
+ length *= 2;
+
w = length;
source = read_block (&w);
@@ -288,9 +292,13 @@ static void
unformatted_write (bt type, void *source, int length)
{
void *dest;
- dest = write_block (length);
- if (dest != NULL)
- memcpy (dest, source, length);
+
+ if (type == BT_COMPLEX)
+ length *= 2;
+
+ dest = write_block (length);
+ if (dest != NULL)
+ memcpy (dest, source, length);
}
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobi at gcc dot gnu dot org
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18710