aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>2004-12-02 20:39:15 +0100
committerTobias Schlüter <tobi@gcc.gnu.org>2004-12-02 20:39:15 +0100
commitabd7fea9f9afbe42fbaad073dab52e7d78640543 (patch)
tree05580d191473440752eaeddfac5929d59504e771 /libgfortran
parent0396df8ac45acfbace58f00234eed18303387b7b (diff)
downloadgcc-abd7fea9f9afbe42fbaad073dab52e7d78640543.zip
gcc-abd7fea9f9afbe42fbaad073dab52e7d78640543.tar.gz
gcc-abd7fea9f9afbe42fbaad073dab52e7d78640543.tar.bz2
re PR libfortran/18710 (img part of complex number not written to direct access file)
libgfortran/ PR fortran/18710 * io/transfer.c (unformatted_read, unformatted_write): width of a COMPLEX is twice its kind. gcc/testsuite/ PR fortran/18170 * gfortran.dg/direct_io_3.f90: New test. From-SVN: r91656
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/transfer.c18
2 files changed, 21 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 2ee79b2..4dfb335 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-02 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.
+
2004-12-02 Richard Sandiford <rsandifo@redhat.com>
* configure.ac: Use TL_AC_GCC_VERSION to set gcc_version.
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index ceff76f..c27f0f7 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -271,6 +271,13 @@ unformatted_read (bt type, void *dest, int length)
{
void *source;
int w;
+
+ /* Transfer functions get passed the kind of the entity, so we have
+ to fix this for COMPLEX data which are twice the size of their
+ kind. */
+ if (type == BT_COMPLEX)
+ length *= 2;
+
w = length;
source = read_block (&w);
@@ -288,9 +295,14 @@ static void
unformatted_write (bt type, void *source, int length)
{
void *dest;
- dest = write_block (length);
- if (dest != NULL)
- memcpy (dest, source, length);
+
+ /* Correction for kind vs. length as in unformatted_read. */
+ if (type == BT_COMPLEX)
+ length *= 2;
+
+ dest = write_block (length);
+ if (dest != NULL)
+ memcpy (dest, source, length);
}