[LLVMbugs] [Bug 16479] New: extern inline inconsistent behavior between GCC and Clang

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 27 19:59:23 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16479

            Bug ID: 16479
           Summary: extern inline inconsistent behavior between GCC and
                    Clang
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wenhan.gu at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ clang --version
clang version 3.4 (http://llvm.org/git/clang.git
2726877196b41b922f10f794801b313980e1a8ad) (http://llvm.org/git/llvm.git
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);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130628/cbe62778/attachment.html>


More information about the llvm-bugs mailing list