Patchwork Fix reading real(kind=10) numbers

login
register
mail settings
Submitter Andreas Schwab
Date July 25, 2012, 4:40 p.m.
Message ID <m2wr1rg5fa.fsf@igel.home>
Download mbox | patch
Permalink /patch/173213/
State New
Headers show

Comments

Andreas Schwab - July 25, 2012, 4:40 p.m.
This fixes a mixup of kind and size when storing a real(kind=10) number
for read, causing a loss of two bytes.  Tested on m68k-linux and checked
in as obvious.

Andreas.

	* io/list_read.c (list_formatted_read_scalar): Fix copying real
	value back to temporary.

Patch

diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 6155d97..9d301d6 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1888,7 +1888,7 @@  list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p,
       read_real (dtp, p, kind);
       /* Copy value back to temporary if needed.  */
       if (dtp->u.p.repeat_count > 0)
-	memcpy (dtp->u.p.value, p, kind);
+	memcpy (dtp->u.p.value, p, size);
       break;
     case BT_COMPLEX:
       read_complex (dtp, p, kind, size);