https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77681
Bug ID: 77681 Summary: failing to inline simple function when using -fgnu-tm Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pc at us dot ibm.com Target Milestone: --- Created attachment 39671 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39671&action=edit testcase where always_inline fails with -fgnu-tm I've used several different versions of GCC, including 4.8.5 and 6.2.1, on different architectures (x86_64 and ppc64le). I first noticed that a very simple "static inline" function was not being inlined. When I added "__attribute__((always_inline))", an error was produced (see below). In narrowing down the testcase, I also tried to narrow down the command line, and discovered that the error is only produced when "-fgnu-tm" is present. The narrowed-down testcase makes no use of transactional memory, so there appears to be some inlining interference caused by "-fgnu-tm". -- $ g++ -O3 -c always-inline.cpp -fgnu-tm -o /dev/null always-inline.cpp: In member function ‘T* spsc<T>::pop() [with T = int]’: always-inline.cpp:9:1: error: inlining failed in call to always_inline ‘void* _ZL13SPHGetFreePtrPv.constprop.0()’: SPHGetFreePtr (void *H) { ^ always-inline.cpp:19:32: error: called from here T** p = (T**) SPHGetFreePtr(0); $ g++ -O3 -c always-inline.cpp -o /dev/null $ --