[Bug bootstrap/78493] New: profiledbootstrap failure: error: attempt to free a non-heap object 'names' in ../../gcc/cp/parser.c:11482:23
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 23 13:16:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78493
Bug ID: 78493
Summary: profiledbootstrap failure: error: attempt to free a
non-heap object 'names' in
../../gcc/cp/parser.c:11482:23
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
I hit very interesting -Werror:
In file included from ../../gcc/hash-table.h:236:0,
from ../../gcc/coretypes.h:351,
from ../../gcc/cp/parser.c:23:
In static member function 'static void va_heap::release(vec<T, va_heap,
vl_embed>*&) [with T = tree_node*]',
inlined from 'void vec<T, va_heap, vl_ptr>::release() [with T =
tree_node*]' at ../../gcc/vec.h:1497:3,
inlined from 'auto_vec<T, N>::~auto_vec() [with T = tree_node*; long
unsigned int N = 16ul]' at ../../gcc/vec.h:1275:5,
inlined from 'tree_node* cp_parser_range_for(cp_parser*, tree, tree, tree,
bool)' at ../../gcc/cp/parser.c:11482:23:
../../gcc/vec.h:307:3: error: attempt to free a non-heap object 'names'
[-Werror=free-nonheap-object]
::free (v);
^~
Problem is that function cp_parser_range_for uses auto_vec <tree, 16> names;
and as it only uses quick_push function, then m_vec == &m_auto:
auto_vec ()
{
m_auto.embedded_init (MAX (N, 2), 0, 1);
this->m_vec = &m_auto;
}
and as ~auto_vec calls release:
template<typename T>
inline void
vec<T, va_heap, vl_ptr>::release (void)
{
if (!m_vec)
return;
if (using_auto_storage ())
{
m_vec->m_vecpfx.m_num = 0;
return;
}
va_heap::release (m_vec);
}
Because of we probably can't prove that m_vec->m_vecpfx.m_using_auto_storage ==
1, we end up with free (&names.m_auto); which is a dead code.
More information about the Gcc-bugs
mailing list