This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: libgfortran patch for PR target/23556 (strict alignment fix)
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: Thomas dot Koenig at online dot de
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 31 Aug 2005 10:03:10 -0700 (PDT)
- Subject: Re: libgfortran patch for PR target/23556 (strict alignment fix)
> > OK for checkin?
>
> OK for both mainline and 4.0 (assuming you tested it on both).
>
> The same problem also occurs in set_integer. The identical fix
> would qualify as obvious after committing this one.
FYI: Here is the set_integer patch I tested and am checking in on the
mainline. I am still working on building and testing the 4.0 branch
versions.
2005-08-31 Steve Ellcey <sje@cup.hp.com>
* io/read.c (set_integer): Use memcpy to fill buffer.
*** gcc.orig/libgfortran/io/read.c Wed Aug 31 09:59:19 2005
--- gcc/libgfortran/io/read.c Wed Aug 31 09:59:38 2005
*************** set_integer (void *dest, GFC_INTEGER_LAR
*** 49,68 ****
{
#ifdef HAVE_GFC_INTEGER_16
case 16:
! *((GFC_INTEGER_16 *) dest) = value;
break;
#endif
case 8:
! *((GFC_INTEGER_8 *) dest) = value;
break;
case 4:
! *((GFC_INTEGER_4 *) dest) = value;
break;
case 2:
! *((GFC_INTEGER_2 *) dest) = value;
break;
case 1:
! *((GFC_INTEGER_1 *) dest) = value;
break;
default:
internal_error ("Bad integer kind");
--- 49,83 ----
{
#ifdef HAVE_GFC_INTEGER_16
case 16:
! {
! GFC_INTEGER_16 tmp = value;
! memcpy (dest, (void *) &tmp, length);
! }
break;
#endif
case 8:
! {
! GFC_INTEGER_8 tmp = value;
! memcpy (dest, (void *) &tmp, length);
! }
break;
case 4:
! {
! GFC_INTEGER_4 tmp = value;
! memcpy (dest, (void *) &tmp, length);
! }
break;
case 2:
! {
! GFC_INTEGER_2 tmp = value;
! memcpy (dest, (void *) &tmp, length);
! }
break;
case 1:
! {
! GFC_INTEGER_1 tmp = value;
! memcpy (dest, (void *) &tmp, length);
! }
break;
default:
internal_error ("Bad integer kind");