[LLVMbugs] [Bug 11072] New: Clang mishandles extern inline functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 5 14:24:21 PDT 2011


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

           Summary: Clang mishandles extern inline functions
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: criswell at illinois.edu
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=7406)
 --> (http://llvm.org/bugs/attachment.cgi?id=7406)
Test file to help reproduce the problem

As far as I know, when a function is marked with extern inline, it should
either be treated as an external function (which means that the function body
should not be added to the generated object file) or its body should be inlined
into the caller.

Clang appears to include the function body as an externally visible function. 
This prevents two files that include a header with an extern inline function
from linking because the extern inline function is defined multiple times (once
in each compiled object file).

The function body should either be marked internal when converted to LLVM IR,
or the function body should not be added to the compilation unit at all.

To reproduce:

clang -o test test1.c test2.c

/tmp/test2-ALwjs1.o: In function `foo':
test2.c:(.text+0x0): multiple definition of `foo'
/tmp/test1-7iCfuk.o:test1.c:(.text+0x0): first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list