[PATCH 2/3] Fix autoprofiledbootstrap

Andi Kleen andi@firstfloor.org
Mon Jan 14 08:20:00 GMT 2019


From: Andi Kleen <ak@linux.intel.com>

autoprofiledbootstrap fails currently with

In file included from ../../gcc/gcc/hash-table.h:236,
                 from ../../gcc/gcc/coretypes.h:440,
                 from ../../gcc/gcc/ipa-devirt.c:110:
In static member function 'static void va_heap::release(vec<T, va_heap, vl_embed>*&) [with T = tree_node*]',
    inlined from 'void vec<T>::release() [with T = tree_node*]' at ../../gcc/gcc/vec.h:1679:20,
    inlined from 'auto_vec<T, N>::~auto_vec() [with T = tree_node*; long unsigned int N = 8]' at ../../gcc/gcc/vec.h:1436:5,
    inlined from 'vec<cgraph_node*> possible_polymorphic_call_targets(tree, long int, ipa_polymorphic_call_context, bool*, void**, bool)' at ../../gcc/gcc/ipa-devirt.c:3099:22:
../../gcc/gcc/vec.h:311:10: error: attempt to free a non-heap object 'bases_to_consider' [-Werror=free-nonheap-object]
  311 |   ::free (v);
      |   ~~~~~~~^~~
../../gcc/gcc/vec.h:311:10: error: attempt to free a non-heap object 'bases_to_consider' [-Werror=free-nonheap-object]
cc1plus: all warnings being treated as errors

The problem is that auto_vec uses a variable to keep track if the vector
is on the heap or auto. Normally this gets constant resolved, but only
when the right functions are inlined. With autofdo for some reason
the compiler decides to not inline these vec functions, even though
they are marked as "inline"

Mark them as ALWAYS_INLINE instead.

gcc/:

2019-01-14  Andi Kleen  <ak@linux.intel.com>

	* vec.h (using_auto_storage, release): Mark as ALWAYS_INLINE.
---
 gcc/vec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/vec.h b/gcc/vec.h
index 407269c5ad3..1f5b78b1fac 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1664,7 +1664,7 @@ vec<T, va_heap, vl_ptr>::create (unsigned nelems MEM_STAT_DECL)
 /* Free the memory occupied by the embedded vector.  */
 
 template<typename T>
-inline void
+ALWAYS_INLINE void
 vec<T, va_heap, vl_ptr>::release (void)
 {
   if (!m_vec)
@@ -1940,7 +1940,7 @@ vec<T, va_heap, vl_ptr>::reverse (void)
 }
 
 template<typename T>
-inline bool
+ALWAYS_INLINE bool
 vec<T, va_heap, vl_ptr>::using_auto_storage () const
 {
   return m_vec->m_vecpfx.m_using_auto_storage;
-- 
2.19.1



More information about the Gcc-patches mailing list