diff options
author | sje <sje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-31 16:58:28 +0000 |
---|---|---|
committer | sje <sje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-31 16:58:28 +0000 |
commit | 5bff83ad6c6e216cf9ae87b045c3ab3dc068a16b (patch) | |
tree | 6050398543fbd94e4ceab8d5f470c8381bdfdf7d /libgfortran | |
parent | 03fa0f082ff88166f4bc714c2b6d7b632d0f5b08 (diff) | |
download | gcc-5bff83ad6c6e216cf9ae87b045c3ab3dc068a16b.tar.gz |
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
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 5 | ||||
-rw-r--r-- | libgfortran/io/read.c | 24 |
2 files changed, 23 insertions, 6 deletions
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 <sje@cup.hp.com> + + PR target/23556 + * io/read.c (convert_real): Use memcpy to fill buffer. + 2005-08-29 Thomas Koenig <Thomas.Koenig@online.de> 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: |