[LLVMbugs] [Bug 22720] New: 'inline' function not generated at -O0

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 26 15:54:23 PST 2015


            Bug ID: 22720
           Summary: 'inline' function not generated at -O0
           Product: clang
           Version: 3.5
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michael at thelayzells.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When compiling the following C code at `-O0`, the `inline` function foo isn't
inlined, and no function body is generated for it. Linking fails, as the symbol
`foo` is not found. When compiling at `-O2` the code compiles correctly (as
foo() is inlined).


I first noticed this on my mac:
% gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

But have also found the problem on a linux box:
% clang --version
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix


// test.c
inline int foo() {
  return 5;

int main() {
  return foo();


I've thrown the IR output and run logs in a gist:

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/20150226/7cf48100/attachment.html>

More information about the llvm-bugs mailing list