Commit 98cd8256 by Steve Ellcey Committed by Steve Ellcey

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
parent 9f36bc49
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> 2005-09-05 Thomas Koenig <Thomas.Koenig@online.de>
* io/list_read.c: Adjust size of of value to 32 (to hold * io/list_read.c: Adjust size of of value to 32 (to hold
......
...@@ -79,20 +79,40 @@ extract_int (const void *p, int len) ...@@ -79,20 +79,40 @@ extract_int (const void *p, int len)
switch (len) switch (len)
{ {
case 1: case 1:
i = *((const GFC_INTEGER_1 *) p); {
GFC_INTEGER_1 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
case 2: case 2:
i = *((const GFC_INTEGER_2 *) p); {
GFC_INTEGER_2 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
case 4: case 4:
i = *((const GFC_INTEGER_4 *) p); {
GFC_INTEGER_4 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
case 8: case 8:
i = *((const GFC_INTEGER_8 *) p); {
GFC_INTEGER_8 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
#ifdef HAVE_GFC_INTEGER_16 #ifdef HAVE_GFC_INTEGER_16
case 16: case 16:
i = *((const GFC_INTEGER_16 *) p); {
GFC_INTEGER_16 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
#endif #endif
default: default:
...@@ -113,20 +133,40 @@ extract_uint (const void *p, int len) ...@@ -113,20 +133,40 @@ extract_uint (const void *p, int len)
switch (len) switch (len)
{ {
case 1: 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; break;
case 2: 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; break;
case 4: 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; break;
case 8: 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; break;
#ifdef HAVE_GFC_INTEGER_16 #ifdef HAVE_GFC_INTEGER_16
case 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; break;
#endif #endif
default: default:
...@@ -143,19 +183,35 @@ extract_real (const void *p, int len) ...@@ -143,19 +183,35 @@ extract_real (const void *p, int len)
switch (len) switch (len)
{ {
case 4: case 4:
i = *((const GFC_REAL_4 *) p); {
GFC_REAL_4 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
case 8: case 8:
i = *((const GFC_REAL_8 *) p); {
GFC_REAL_8 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
#ifdef HAVE_GFC_REAL_10 #ifdef HAVE_GFC_REAL_10
case 10: case 10:
i = *((const GFC_REAL_10 *) p); {
GFC_REAL_10 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
#endif #endif
#ifdef HAVE_GFC_REAL_16 #ifdef HAVE_GFC_REAL_16
case 16: case 16:
i = *((const GFC_REAL_16 *) p); {
GFC_REAL_16 tmp;
memcpy ((void *) &tmp, p, len);
i = tmp;
}
break; break;
#endif #endif
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment