This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] 69759 - document __builtin_alloca and __builtin_alloca_with_align
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 16 Feb 2016 13:44:15 +0000
- Subject: Re: [PATCH] 69759 - document __builtin_alloca and __builtin_alloca_with_align
- Authentication-results: sourceware.org; auth=none
- References: <56BF8976 dot 3080907 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1602152315580 dot 14423 at digraph dot polyomino dot org dot uk> <56C2951E dot 1040304 at gmail dot com>
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