This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/21333] in_pack / in_unpack alignment issues


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]