<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:femtium@protonmail.com" title="Doctor Strange <femtium@protonmail.com>"> <span class="fn">Doctor Strange</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Clang generates wrong alignment on packed structs (looks like #5598 again)"
href="https://bugs.llvm.org/show_bug.cgi?id=47824">bug 47824</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>FIXED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Clang generates wrong alignment on packed structs (looks like #5598 again)"
href="https://bugs.llvm.org/show_bug.cgi?id=47824#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Clang generates wrong alignment on packed structs (looks like #5598 again)"
href="https://bugs.llvm.org/show_bug.cgi?id=47824">bug 47824</a>
from <span class="vcard"><a class="email" href="mailto:femtium@protonmail.com" title="Doctor Strange <femtium@protonmail.com>"> <span class="fn">Doctor Strange</span></a>
</span></b>
<pre>Thank you very much for the detailed explanation.
Just now, I was having a discussion on discord about this, and learned more of
how aligned and packed work together.
I'm trying to build a mental model of this behaviour - if you have time,
perhaps you can tell me if the following is correct?
1) Each struct has a required alignment, which is either derived or explicitly
set
2) An n-aligned element must start at an address such that addr % n == 0.
3) Structs with unspecified alignment will use the maximum for any fields it
contains
4) The aligned(x) attribute specifies the minimum alignment required.
5) The "packed" attribute (e.g. on a struct) forbids padding, both between
fields in the struct, and before/after the struct itself, if the struct is used
as a field elsewhere.
6) A combination of packed,aligned(n) will pack the struct fields, but still
keep aligned(n) externally.
Is that a fair representation of reality?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>