<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 --- - Incorrect code of variable arguments"
href="http://llvm.org/bugs/show_bug.cgi?id=17789">17789</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect code of variable arguments
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ishiura-compiler@ml.kwansei.ac.jp
</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>Clang 3.4 (based on LLVM 3.4svn) for i386 target miscompiles the following
code.
$ cat error.c
#include <stdarg.h>
struct triple_s { short a; short b; short c; };
void func(struct triple_s s, ... );
int main(void)
{
struct triple_s s = { 1, 1, 1 };
int x = 1;
func(s, x);
return 0;
}
void func(struct triple_s s, ... )
{
int x;
va_list ap;
va_start(ap, s);
x = va_arg(ap, int);
va_end(ap);
if( x != 1 ) { __builtin_abort(); }
}
$ clang error.c
$ ./a.out
Aborted (core dumped)
The value of x was 65556 instead of 1.
There was no problem with an x86_64 target (but fails with -m32 option).</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>