Commit ecbffdd8 by Trevor Saunders Committed by Trevor Saunders

don't try and free what must be a null vector when reserving 0 elements

in va_heap::reserve

2013-11-05  Trevor Saunders  <tsaunders@mozilla.com>

	* vec.c (vec_prefix::calculate_allocation): Don't try to handle the
	case of no prefix and reserving zero slots, because when that's the
	case we'll never get here.
	* vec.h (va_heap::reserve): Don't try and handle
	vec_prefix::calculate_allocation returning zero because that should
	never happen.

From-SVN: r204392
parent 4f94d87c
2013-11-05 Trevor Saunders <tsaunders@mozilla.com>
* vec.c (vec_prefix::calculate_allocation): Don't try to handle the
case of no prefix and reserving zero slots, because when that's the
case we'll never get here.
* vec.h (va_heap::reserve): Don't try and handle
vec_prefix::calculate_allocation returning zero because that should
never happen.
2013-11-05 Richard Biener <rguenther@suse.de> 2013-11-05 Richard Biener <rguenther@suse.de>
PR middle-end/58941 PR middle-end/58941
...@@ -187,9 +187,7 @@ vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve, ...@@ -187,9 +187,7 @@ vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve,
num = pfx->m_num; num = pfx->m_num;
} }
else if (!reserve) else if (!reserve)
/* If there's no vector, and we've not requested anything, then we gcc_unreachable ();
will create a NULL vector. */
return 0;
/* We must have run out of room. */ /* We must have run out of room. */
gcc_assert (alloc - num < reserve); gcc_assert (alloc - num < reserve);
......
...@@ -283,11 +283,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact ...@@ -283,11 +283,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
{ {
unsigned alloc unsigned alloc
= vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact); = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact);
if (!alloc) gcc_assert (alloc);
{
release (v);
return;
}
if (GATHER_STATISTICS && v) if (GATHER_STATISTICS && v)
v->m_vecpfx.release_overhead (); v->m_vecpfx.release_overhead ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment