<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 --- - extern inline inconsistent behavior between GCC and Clang"
href="http://llvm.org/bugs/show_bug.cgi?id=16479">16479</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>extern inline inconsistent behavior between GCC and Clang
</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>Windows XP
</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>wenhan.gu@gmail.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>$ clang --version
clang version 3.4 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
2726877196b41b922f10f794801b313980e1a8ad) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
34b96d15764d51fa53f338e5d7be4d2aa244a945)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ gcc foo.c main.c // It works
$ clang foo.c main.c
/tmp/main-bf76f7.o: In function `isalnum':
main.c:(.text+0x0): multiple definition of `isalnum'
/tmp/foo-a6bb12.o:foo.c:(.text+0x0): first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems clang didn't really inline it, so that we can expect it will be a
declaration only, but clang keeps original function definition.
********
* CODE *
********
$ cat inline.h
extern inline int isalnum(int a) {
// ...
}
$ cat foo.c
#include "inline.h"
void foo() {
isalnum(0);
}
$ cat main.c
#include "inline.h"
int main() {
isalnum(0);
}</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>