re PR libfortran/23419 (unformatted complex I/O with kind=10)

PR libfortran/23419
	* io/write.c (extract_int): Use memcpy to access buffer.
	(extract_uint): Ditto.
	(extract_real): Ditto.

From-SVN: r104000
This commit is contained in:
Steve Ellcey 2005-09-07 20:16:47 +00:00 committed by Steve Ellcey
parent 9f36bc49f8
commit 98cd8256af
2 changed files with 77 additions and 14 deletions

View File

@ -1,3 +1,10 @@
2005-09-07 Steve Ellcey <sje@cup.hp.com>
PR libfortran/23419
* io/write.c (extract_int): Use memcpy to access buffer.
(extract_uint): Ditto.
(extract_real): Ditto.
2005-09-05 Thomas Koenig <Thomas.Koenig@online.de>
* io/list_read.c: Adjust size of of value to 32 (to hold

View File

@ -79,20 +79,40 @@ extract_int (const void *p, int len)
switch (len)
{
case 1:
i = *((const GFC_INTEGER_1 *) p);
{
GFC_INTEGER_1 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
case 2:
i = *((const GFC_INTEGER_2 *) p);
{
GFC_INTEGER_2 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
case 4:
i = *((const GFC_INTEGER_4 *) p);
{
GFC_INTEGER_4 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
case 8:
i = *((const GFC_INTEGER_8 *) p);
{
GFC_INTEGER_8 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
#ifdef HAVE_GFC_INTEGER_16
case 16:
i = *((const GFC_INTEGER_16 *) p);
{
GFC_INTEGER_16 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
#endif
default:
@ -113,20 +133,40 @@ extract_uint (const void *p, int len)
switch (len)
{
case 1:
i = (GFC_UINTEGER_1) *((const GFC_INTEGER_1 *) p);
{
GFC_INTEGER_1 tmp;
memcpy ((void *) &tmp, p, len);
i = (GFC_UINTEGER_1) tmp;
}
break;
case 2:
i = (GFC_UINTEGER_2) *((const GFC_INTEGER_2 *) p);
{
GFC_INTEGER_2 tmp;
memcpy ((void *) &tmp, p, len);
i = (GFC_UINTEGER_2) tmp;
}
break;
case 4:
i = (GFC_UINTEGER_4) *((const GFC_INTEGER_4 *) p);
{
GFC_INTEGER_4 tmp;
memcpy ((void *) &tmp, p, len);
i = (GFC_UINTEGER_4) tmp;
}
break;
case 8:
i = (GFC_UINTEGER_8) *((const GFC_INTEGER_8 *) p);
{
GFC_INTEGER_8 tmp;
memcpy ((void *) &tmp, p, len);
i = (GFC_UINTEGER_8) tmp;
}
break;
#ifdef HAVE_GFC_INTEGER_16
case 16:
i = (GFC_UINTEGER_16) *((const GFC_INTEGER_16 *) p);
{
GFC_INTEGER_16 tmp;
memcpy ((void *) &tmp, p, len);
i = (GFC_UINTEGER_16) tmp;
}
break;
#endif
default:
@ -143,19 +183,35 @@ extract_real (const void *p, int len)
switch (len)
{
case 4:
i = *((const GFC_REAL_4 *) p);
{
GFC_REAL_4 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
case 8:
i = *((const GFC_REAL_8 *) p);
{
GFC_REAL_8 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
#ifdef HAVE_GFC_REAL_10
case 10:
i = *((const GFC_REAL_10 *) p);
{
GFC_REAL_10 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
#endif
#ifdef HAVE_GFC_REAL_16
case 16:
i = *((const GFC_REAL_16 *) p);
{
GFC_REAL_16 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break;
#endif
default: