<html>
<head>
<base href="https://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 --- - extern "C" void fun(struct dummy, struct foo) doesn't always work"
href="https://llvm.org/bugs/show_bug.cgi?id=26337">26337</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>extern "C" void fun(struct dummy, struct foo) doesn't always work
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hjl.tools@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>On x86-64, I got
[hjl@gnu-6 empty-1]$ cat emptya.c
#include "empty.h"
void fun(struct dummy d, struct foo f)
{
if (f.i1 != -1)
__builtin_abort();
}
[hjl@gnu-6 empty-1]$ cat empty.cc
#include "empty.h"
extern "C" void fun(struct dummy, struct foo);
int main()
{
struct dummy d;
struct foo f = { -1, -2, -3, -4, -5 };
fun(d, f);
return 0;
}
[hjl@gnu-6 empty-1]$ cat empty.h
#ifdef __x86_64__
# ifndef PAD_SIZE
# define PAD_SIZE 16
# endif
struct dummy0 { };
struct dummy { struct dummy0 d[PAD_SIZE]; };
#else
# ifndef PAD_SIZE
struct dummy { };
# else
struct dummy0 { };
struct dummy { struct dummy0 d[1]; };
# endif
#endif
struct foo
{
int i1;
int i2;
int i3;
int i4;
int i5;
};
[hjl@gnu-6 empty-1]$ make
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -c -O emptya.c
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -m32 -c -O empty.cc
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -o x emptya.o
empty.o
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -c -O -o
empty1a.o emptya.c -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -m32 -c -O -o
empty1.o empty.cc -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -m32 -o y empty1a.o
empty1.o
./x
./y
Makefile:17: recipe for target 'all' failed
make: *** [all] Aborted
[hjl@gnu-6 empty-1]$ make
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -c -O emptya.c
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -c -O empty.cc
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -o x emptya.o empty.o
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -c -O -o empty1a.o
emptya.c -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang++ -c -O -o empty1.o
empty.cc -DPAD_SIZE=17
/export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -o y empty1a.o
empty1.o
./x
./y
Makefile:17: recipe for target 'all' failed
make: *** [all] Aborted
[hjl@gnu-6 empty-1]$</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>