On Fri, 22 Mar 2013, Ian Lance Taylor wrote:
> On Fri, Mar 22, 2013 at 3:27 AM, Richard Biener <[email protected]> wrote:
> >
> > I think the wrong-code fix is orthogonal to code improvements
> > which will also trigger on the GIMPLE level (and where they
> > will have a bigger impact).
>
> I agree. I think the patch to calls is fine unless Jakub objects.
>
>
> > We can for example, in config/linux.h do
> >
> > #if OPTION_GLIBC
> > #undef MALLOC_ABI_ALIGNMENT
> > #define MALLOC_ABI_ALIGNMENT (2 * sizeof (void *))
> > #endif
> >
> > if that's what glibc really guarantees (does it maybe have a
> > feature macro for this?)
>
> The code in glibc seems to be in malloc.c only. The most conservative
> version seems to be
>
> #define INTERNAL_SIZE_T size_t
> #define SIZE_SZ (sizeof(INTERNAL_SIZE_T))
> # define MALLOC_ALIGNMENT (2 * SIZE_SZ)
>
> In GCC terms this would be 2 * int_size_in_bytes (size_type_node).
Or, given
/* Define what type to use for size_t. */
if (strcmp (SIZE_TYPE, "unsigned int") == 0)
size_type_node = unsigned_type_node;
...
#define MALLOC_ABI_ALIGNMENT (2 * sizeof (### magic un-stringify SIZE_TYPE))
eh ... is there a more convenient way to access the targets size_t?
It's a target macro still ... not often used, so even
#define MALLOC_ABI_ALIGNMENT (2 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT
(size_type_node)))
would probably work, but ...
Richard.