Created attachment 32610 [details] source file this code was accepted by gcc-4.8 up to (at least) gcc-4.9-20140323, but g++ (GCC) 4.9.0 20140411 (prerelease) complains. compiled with g++ -c -O2 --std=c++11 test.cpp error message of gcc-4.9.0 prerelease: test.cpp: In function ‘void Func()’: test.cpp:5:46: error: inlining failed in call to always_inline ‘MyClass<T>::MyClass() [with T = double]’: function body not available __attribute__ ((__always_inline__)) inline MyClass () { ; } ^ test.cpp:12:19: error: called from here MyClass<double> x; ^
Not sure how the C++ 'extern template' explicit instantiation interacts with the GCC always-inline extension. But with always-inline it is an _error_ to have a function not inlined and thus we omit the body of the function. Somehow early inlining doesn't see that MyClass::MyClass is always-inline, this works in 4.8 and the constructor is always-inlined. Honza?
There is cpp implicit alias, seems like unreachable node removal now gets confused about it. I am looking into it.
OK, the problem is that we see the reference to alias and decide to keep the alias for future inlining. But when processing the refernce from alias to function itself, we throw it away. We need to keep the body, too ;) (the existing node->alias check actually cares about oposite case where we want to keep weakrefs) Index: ipa.c =================================================================== --- ipa.c (revision 209435) +++ ipa.c (working copy) @@ -138,7 +138,7 @@ process_references (struct ipa_ref_list symtab_node *node = ref->referred; if (node->definition && !node->in_other_partition - && ((!DECL_EXTERNAL (node->decl) || node->alias) + && ((!DECL_EXTERNAL (node->decl) || node->alias || ref->use == IPA_REF_ALIAS) || (((before_inlining_p && (cgraph_state < CGRAPH_STATE_IPA_SSA || !lookup_attribute ("always_inline",
Author: hubicka Date: Thu Apr 17 02:22:57 2014 New Revision: 209459 URL: http://gcc.gnu.org/viewcvs?rev=209459&root=gcc&view=rev Log: PR ipa/60854 * ipa.c (symtab_remove_unreachable_nodes): Mark targets of external aliases alive, too. * g++.dg/torture/pr60854.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/torture/pr60854.C Modified: trunk/gcc/ChangeLog trunk/gcc/ipa.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk sofar.
Author: hubicka Date: Sat May 17 22:18:25 2014 New Revision: 210563 URL: http://gcc.gnu.org/viewcvs?rev=210563&root=gcc&view=rev Log: PR ipa/60854 * ipa.c (symtab_remove_unreachable_nodes): Mark targets of external aliases alive, too. * g++.dg/torture/pr60854.C: New testcase. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/torture/pr60854.C Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/ipa.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Fixed.