This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/21333] in_pack / in_unpack alignment issues
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 May 2005 22:40:48 -0000
- Subject: [Bug libfortran/21333] in_pack / in_unpack alignment issues
- References: <20050502112726.21333.tkoenig@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tkoenig at gcc dot gnu dot org 2005-05-24 22:40 -------
For 4-byte complex, an option is to check the alignment at runtime.
If the complex is aligned on an 8-byte boundary, it should be
perfectly OK to call the 8-byte-integer routines.
The check could be done with a macro like this:
#define GFC_ALIGNMENT_I8(a) (((size_t) (a)) & 7 == 0)
#define GFC_ALIGNMENT_I4(a) (((size_t) (a)) & 3 == 0)
and the code look like
if (size == 8)
{
if (GFC_ALIGNMENT_I8(ptr))
return internal_pack_8(whatever)
else if (GFC_ALIGNMENT_I4(ptr))
return internal_pack_c4(whatever)
/* Fall through to generic routine */
}
OK in principle? Too horrible to contemplate?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21333