[PATCH] 69759 - document __builtin_alloca and __builtin_alloca_with_align

Joseph Myers joseph@codesourcery.com
Tue Feb 16 13:44:00 GMT 2016


On Tue, 16 Feb 2016, Martin Sebor wrote:

> That said, I think it's worth pointing out that max_align_t has
> nothing to do with standard C types.  The intent of the type is
> to expose a type with the strictest alignment supported by
> an implementation for an object of any type and with any storage
> duration, not the alignment of the most strictly aligned basic
> (or fundamental) type.

The minimum alignment for max_align_t (given the proposed fix for DR#445) 
is defined in terms of standard types (where if various extensions in TRs 
and TSes are implemented, the types in those are standard types for this 
purpose).  While an implementation may choose to use a larger alignment 
than the minimum, it's inefficient to do so, considering that malloc must 
return suitably aligned memory even when the size allocated is smaller 
than the alignment (and GCC chooses to use the minimum, modulo taking the 
alignments that long long and long double have outside structures rather 
than their possibly smaller alignments inside structures).

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list