This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix PR56434
- From: Richard Biener <rguenther at suse dot de>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Mar 2013 14:46:51 +0100 (CET)
- Subject: Re: [PATCH] Fix PR56434
- References: <alpine dot LNX dot 2 dot 00 dot 1303221103500 dot 3543 at zhemvz dot fhfr dot qr> <20130322101935 dot GW12913 at tucnak dot redhat dot com> <alpine dot LNX dot 2 dot 00 dot 1303221124480 dot 3543 at zhemvz dot fhfr dot qr> <CAKOQZ8wcdaYwDpRncJr_4u_dWrzZGYYzRE-F9v98wF8WK8iVOQ at mail dot gmail dot com>
On Fri, 22 Mar 2013, Ian Lance Taylor wrote:
> On Fri, Mar 22, 2013 at 3:27 AM, Richard Biener <email@example.com> 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).
/* 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
would probably work, but ...