<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - MS ABI: __declspec(align(N)) ignored inside pragma pack when applied to a non-record type"
href="http://llvm.org/bugs/show_bug.cgi?id=20418">20418</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>MS ABI: __declspec(align(N)) ignored inside pragma pack when applied to a non-record type
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rnk@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>david.majnemer@gmail.com, fjahanian@apple.com, llvmbugs@cs.uiuc.edu, richard-llvm@metafoo.co.uk, whunt@google.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider:
typedef __declspec(align(4)) int my_int_t;
#pragma pack(1)
struct A {
char a;
my_int_t x;
};
static_assert(sizeof(A) == 8, "");
MSVC record layout tracks two kinds of alignment: required and natural
alignment. Inside pragma pack, "required" alignment (alignment from
attributes) trumps the pragma pack alignment. However, only records have a
concept of required alignment. Typedefs of scalar types can also have a
required alignment, and we need to track it.
We would also need to track this in the Itanium C++ record layout code if we
want to implement this there, either in general or under ms_struct, as
discussed here:
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-July/038193.html">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-July/038193.html</a>
getTypeInfo should probably be augmented to return more information: size,
natural alignment, required alignment.</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>