re PR target/23556 (FAIL: gfortran.dg/pr18122.f90)
authorSteve Ellcey <sje@cup.hp.com>
Wed, 31 Aug 2005 16:58:28 +0000 (16:58 +0000)
committerSteve Ellcey <sje@gcc.gnu.org>
Wed, 31 Aug 2005 16:58:28 +0000 (16:58 +0000)
PR target/23556
* io/read.c (convert_real): Use memcpy to fill buffer.

From-SVN: r103685

libgfortran/ChangeLog
libgfortran/io/read.c

index 98ae306..44a9fcf 100644 (file)
@@ -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
index b127cd9..e37224d 100644 (file)
@@ -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: