[PATCH 06/25] Add struct scratch_buffer and its internal helper functions

Joseph Myers joseph@codesourcery.com
Mon Mar 23 18:41:00 GMT 2015


On Mon, 23 Mar 2015, Paul Eggert wrote:

> Florian Weimer wrote:
> > I would rather go with intmax_t because it's not
> > clear to me if __alignof__ (max_align_t) increases to 64 if AVX-512 is
> > enabled on x86_64.
> 
> That would be a bug in the C compiler, right?
> 
> Since C allows platforms where pointers and/or floating-point values have
> alignments stricter than intmax_t, I suggest using 'max (__alignof__
> (intmax_t), __alignof__ (max_align_t))' along with a comment explaining why
> you don't trust max_align_t here.

max_align_t was added to stddef.h in GCC 4.7, so we can't rely on it in 
glibc without appropriate conditionals.  However, I see no need to allow 
for it being wrong (in code that isn't used outside of glibc).

It may well be more-aligned than intmax_t, on platforms where long double 
has 16-byte size and alignment and intmax_t has 8-byte size and alignment 
- so that does need allowing for in glibc.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list