Fix reading real(kind=10) numbers

Andreas Schwab schwab@linux-m68k.org
Wed Jul 25 16:41:00 GMT 2012


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.

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);
-- 
1.7.11.3

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Gcc-patches mailing list