G_MEM_ALIGN may not be correct
- From: David Mosberger <davidm napali hpl hp com>
- To: gtk-devel-list gnome org
- Subject: G_MEM_ALIGN may not be correct
- Date: Tue, 21 Dec 2004 16:46:47 -0800
Hi,
I hope it's appropriate to discuss glib issues on this list. If not,
my apologies (please direct me to a more appropriate place in that
case).
I noticed that gmem.h declares:
#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG
# define G_MEM_ALIGN GLIB_SIZEOF_VOID_P
#else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */
# define G_MEM_ALIGN GLIB_SIZEOF_LONG
#endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */
(I verified that this code is still in the CVS-version of glib.)
Unfortunately, this isn't sufficient for ia64 (and perhaps other
platforms) because on that platform, malloc-like routines need to
guarantee 16-byte alignment due to the fact that "long double" typed
variables need to be 16-byte aligned.
There are several ways to solve this problem. For example, we could
mirror the glibc malloc, which uses 2*sizeof(size_t) alignment, or we
could mirror what the GNU obstack implementation does (that would
require config-time checking of alignment, though). Of course, we
could also just check for #ifdef __ia64, though that seems fragile and
too platform-specific.
Does anybody have a preference for how to get this fixed?
Thanks,
--david
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]