This is the mail archive of the gcc-patches@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: [PATCH] Fix minimal alignment calculation for user-aligned types (PR63802)


On Mon, 17 Nov 2014, Jakub Jelinek wrote:

> > The question, for both _Alignas and ubsan, is the alignment guaranteed *in 
> > valid programs*.
> > 
> > malloc only provides sufficient alignment for types with fundamental 
> > alignment requirements (although there are various problems with the C11 
> > wording; see DR#445).  So if you use malloc to allocate a type with an 
> > extended alignment requirement (without doing extra realignment on the 
> > result of malloc), that's not a valid program.  And if an alignment is 
> > larger than MAX_OFILE_ALIGNMENT, you get an error for declaring non-stack 
> > variables requiring that alignment.  So I don't think there's any need to 
> > check MAX_OFILE_ALIGNMENT here.
> 
> If so, then Yuri's original patch (the one changing min_align_of_type)
> should be fine, right?

Yes.

-- 
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]