From 452b4a216a6caf31545fe3b3004ba56d436578a7 Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 31 Aug 2005 17:05:52 +0000 Subject: [PATCH] * io/read.c (set_integer): Use memcpy to fill buffer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103687 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 4 ++++ libgfortran/io/read.c | 25 ++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 44a9fcf63b64..5883d29042c3 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,5 +1,9 @@ 2005-08-31 Steve Ellcey + * io/read.c (set_integer): Use memcpy to fill buffer. + +2005-08-31 Steve Ellcey + PR target/23556 * io/read.c (convert_real): Use memcpy to fill buffer. diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index e37224d5f8fa..64231b936c26 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -49,20 +49,35 @@ set_integer (void *dest, GFC_INTEGER_LARGEST value, int length) { #ifdef HAVE_GFC_INTEGER_16 case 16: - *((GFC_INTEGER_16 *) dest) = value; + { + GFC_INTEGER_16 tmp = value; + memcpy (dest, (void *) &tmp, length); + } break; #endif case 8: - *((GFC_INTEGER_8 *) dest) = value; + { + GFC_INTEGER_8 tmp = value; + memcpy (dest, (void *) &tmp, length); + } break; case 4: - *((GFC_INTEGER_4 *) dest) = value; + { + GFC_INTEGER_4 tmp = value; + memcpy (dest, (void *) &tmp, length); + } break; case 2: - *((GFC_INTEGER_2 *) dest) = value; + { + GFC_INTEGER_2 tmp = value; + memcpy (dest, (void *) &tmp, length); + } break; case 1: - *((GFC_INTEGER_1 *) dest) = value; + { + GFC_INTEGER_1 tmp = value; + memcpy (dest, (void *) &tmp, length); + } break; default: internal_error ("Bad integer kind"); -- 2.11.4.GIT