From 5bff83ad6c6e216cf9ae87b045c3ab3dc068a16b Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 31 Aug 2005 16:58:28 +0000 Subject: PR target/23556 * io/read.c (convert_real): Use memcpy to fill buffer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103685 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 5 +++++ libgfortran/io/read.c | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'libgfortran') diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 98ae3063336..44a9fcf63b6 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2005-08-31 Steve Ellcey + + PR target/23556 + * io/read.c (convert_real): Use memcpy to fill buffer. + 2005-08-29 Thomas Koenig PR libfortran/23598 diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index b127cd997b8..e37224d5f8f 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -124,24 +124,36 @@ convert_real (void *dest, const char *buffer, int length) switch (length) { case 4: - *((GFC_REAL_4 *) dest) = + { + GFC_REAL_4 tmp = #if defined(HAVE_STRTOF) - strtof (buffer, NULL); + strtof (buffer, NULL); #else - (GFC_REAL_4) strtod (buffer, NULL); + (GFC_REAL_4) strtod (buffer, NULL); #endif + memcpy (dest, (void *) &tmp, length); + } break; case 8: - *((GFC_REAL_8 *) dest) = strtod (buffer, NULL); + { + GFC_REAL_8 tmp = strtod (buffer, NULL); + memcpy (dest, (void *) &tmp, length); + } break; #if defined(HAVE_GFC_REAL_10) && defined (HAVE_STRTOLD) case 10: - *((GFC_REAL_10 *) dest) = strtold (buffer, NULL); + { + GFC_REAL_10 tmp = strtold (buffer, NULL); + memcpy (dest, (void *) &tmp, length); + } break; #endif #if defined(HAVE_GFC_REAL_16) && defined (HAVE_STRTOLD) case 16: - *((GFC_REAL_16 *) dest) = strtold (buffer, NULL); + { + GFC_REAL_16 tmp = strtold (buffer, NULL); + memcpy (dest, (void *) &tmp, length); + } break; #endif default: -- cgit v1.2.1