<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div><br></div><div>- Fariborz</div><div><br><div><div>On Aug 1, 2014, at 10:45 AM, jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi John,<div><br></div><div>Here is the revised patch.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div></div>
<span><patch.txt></span><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div>- Fariborz</div><div><br><div><div><div>On Jul 28, 2014, at 6:58 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Jul 28, 2014, at 4:22 PM, jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:<br><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">This patch enforces SuitableAlign’s alignment when loading objects with more relaxed alignment. Currently, SuitableAlign is used in a<div>warning when type is over aligned. This patch optionally enforces this in IRGen. I defined a new field in TargetInfo which is optionally set to</div><div>SuitableAlign. Currently, this is only defined for Apple’s targets as I don’t know its implication for all other supported targets. Long term,</div><div>we want to use one value for both (Sema and code gen). This is <a href="rdar://">rdar://</a><span style="font-family: Menlo; font-size: 11px;">16254558</span></div></div></blockquote><div><br></div>We can’t change the ABI alignment; that would change struct layout.</div><div><br></div><div>The right way of doing this is a code generation option that caps the effective alignment that we’ll honor on an access to a pointer lacking an explicit alignment attribute. It should be exposed to users; I suggest spelling it something like -fmax-type-align=N, with an option to disable it completely called -fno-max-type-align. You can have the driver pass down -fmax-type-align=16 by default when targeting Darwin.</div><div><br></div><div>+ static bool RestrictedCompleteObjectAlign(QualType T) {</div><div><br></div><div>What this is really asking is whether the type has an explicit alignment attribute. The most reasonable thing to do is to have ASTContext::getTypeInfoImpl compute (and cache) this information; that will correctly look through recursive sugar, which you are not doing. You can add a new accessor (ASTContext::getTypeAlignInCharsAndIsExplicit?) which returns a pair of the alignment and this bool.</div><div><br></div><div>You should add a test case that checks that a typedef of an aligned typedef is still considered explicitly aligned.</div><div><br></div><div>There is nothing here that should be specific to ElaboratedType. Whatever that logic is, it should be testing for RecordType. But I actually think you should be applying the same logic to structs and unions that you do to any other type: we should be capping the (non-ABI) alignment of structs and unions unless they have an explicit AlignedAttr.</div><div><br></div><div>John.</div></div></blockquote></div><br></div></div></div>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote></div><br></div></body></html>