[llvm-bugs] [Bug 36236] clang generates wrong module by removing un-inlined function body in -O0

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 5 07:52:09 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36236

David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |dblaikie at gmail.com
             Status|NEW                         |RESOLVED

--- Comment #1 from David Blaikie <dblaikie at gmail.com> ---
I believe this is correct behavior for C99. GCC does the same thing:

$ cat inl.c
inline void foo() {
}
int main() {
  foo();
}
$ gcc inl.c -std=c99
/tmp/ccMjLRUx.o: In function `main':
inl.c:(.text+0xa): undefined reference to `foo'

I can't find the proper reference for it, but my understanding is that in C the
inlinable definition is potentially separate from the non-inlined definition (
https://gustedt.wordpress.com/2010/11/29/myth-and-reality-about-inline-in-c99/
discusses this with examples)

-- 
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/20180205/2dbd4304/attachment-0001.html>


More information about the llvm-bugs mailing list