http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60235
Bug ID: 60235 Summary: Inlining fails with template specialization and -fPIC on Linux AMD64 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: joker.eph at gmail dot com Tested with g++-4.6, g++4.8 and current svn: $ ./gcc-svn-install/bin/g++ --version g++ (GCC) 4.9.0 20140217 (experimental) I have a simple C++ code that exhibit this issue: a simple templated function using one int as template parameter. When a specialization is provided the call is not inlined, but only when compiling with -fPIC (Ubuntu Linux AMD64). The issue does not appear with g++-4.8 on OSX. Clang does not have this issue, in the benchmark I extracted this minimal test case from, this missing inline doubles the running time. To reproduce : $ g++ inlining.cpp -O2 -S -fPIC -DNOSPECIALIZATION $ grep get inlining.s | grep call $ g++ inlining.cpp -O2 -S -fPIC $ grep get inlining.s | grep call call _Z3getILi0EERdPd@PLT