[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    Fix reading real(kind=10) numbers
From:       Andreas Schwab <schwab () linux-m68k ! org>
Date:       2012-07-25 16:40:41
Message-ID: m2wr1rg5fa.fsf () igel ! home
[Download RAW message or body]

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."
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic