[PATCH] malloc: fix undefined behavior in obstack.h [BZ #32393]
Sam James
sam@gentoo.org
Tue Apr 29 17:54:06 GMT 2025
Paul Eggert <eggert@cs.ucla.edu> writes:
> On 2025-04-28 20:39, Collin Funk wrote:
>
>> +# define PTR_UINT_TYPE __UINTPTR_TYPE__
>
> Let's call this new macro __PTR_UINT_TYPE instead, to avoid namespace
> pollution.
>
>
>> +#define __PTR_ALIGN(B, P, A) \
>> + (sizeof (PTR_INT_TYPE) < sizeof (void *) \
>> + ? (B) + (((P) - (B) + (A)) & ~(A)) \
>> + : (P) + ((- (PTR_UINT_TYPE) (P)) & (A)))
>
> This collides with Gnulib, which needs to do this a different way to
> avoid a compiler error with Oracle Developer Studio. Although
> admittedly it'll take a bit of work to merge with Gnulib, let's not
> make merging harder.
>
> How about the attached patch instead?
I have something similar in a local copy of a sync for gcc I haven't
finished off:
Reviewed-by: Sam James <sam@gentoo.org>
(but I think Collin's was fine too, just your point is fair about not
making it harder to sync.)
>
> [2. text/x-patch; 0001-malloc-fix-undefined-behavior-in-obstack.h-BZ-32393.patch]...
More information about the Libc-alpha
mailing list