<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 --- - Clang should diagnose when parameter alignment will not be honored due to the ABI"
href="http://llvm.org/bugs/show_bug.cgi?id=18140">18140</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang should diagnose when parameter alignment will not be honored due to the ABI
</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>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ cat t.cpp
struct S {
~S();
__declspec(align(16)) char thing[16];
};
void thing(S a, int b, S c) {}
int main() {
S s;
thing(s, 1, s);
}
$ cl -c t.cpp -nologo
t.cpp
t.cpp(5) : error C2719: 'a': formal parameter with __declspec(align('16'))
won't be aligned
t.cpp(5) : error C2719: 'c': formal parameter with __declspec(align('16'))
won't be aligned
$ clang -cc1 -triple i686-pc-win32 t.cpp -emit-llvm -o - | grep byval
define void @_Z5thing1SiS_(%struct.S* byval align 4, i32 %b, %struct.S* byval
align 4) #0 {
call void @_Z5thing1SiS_(%struct.S* byval align 4 %agg.tmp, i32 1, %struct.S*
byval align 4 %agg.tmp1)
We don't emit a diagnostic, and our use of 'byval align 4' here indicates that
we will not attempt to align the struct to more than 4 bytes. Code in
lib/CodeGen/TargetInfo.cpp implements this.</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>