This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: x86_64: Should the -mavx* options affected __alignof__ (max_align_t)?


On Thu, 2 Apr 2015, Florian Weimer wrote:

> On 03/23/2015 07:41 PM, Florian Weimer wrote:
> 
> > Ah, I should have looked at what max_align_t actually meant.  With these
> > semantics, the name is a bit confusing.  I agree that requiring 64 byte
> > alignment from malloc does not make much sense.  Thanks.
> 
> Follow-up question: Can malloc return a pointer which is not aligned to
> _Alignof (max_align_t)?
> 
> This happens with most mallocs on x86_64 for sizes of 8 or less, for
> which these mallocs only provide an alignment of 8.
> 
> DR445 does not seem to have reached consensus on that point.

I see no lack of consensus.  
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1892.htm#dr_445> says 
"The proposed changes have raised no concerns and so the committee has 
agreed to use them as the following Proposed Technical Corrigendum.", and 
nothing regarding alignment for small allocations has changed since 
DR#075.  "suitably aligned so that it may be assigned to a pointer to any 
type of object with a fundamental alignment requirement" (unchanged 
wording in 7.22.3) implies being suitably aligned for all types with 
fundamental alignment requirements; otherwise such assignment would result 
in undefined behavior at runtime.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]