diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2013-11-05 13:51:32 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2013-11-05 13:51:32 +0000 |
commit | ecbffdd88f3f073ded32f1cd632dfb1bfc5d7c38 (patch) | |
tree | 57b2f9ccac9f133f2af4e7f3a1e02c3ad7587f55 /gcc | |
parent | 4f94d87c6171d472fb8f6d2cf0d572d0bd8ebeee (diff) | |
download | gcc-ecbffdd88f3f073ded32f1cd632dfb1bfc5d7c38.zip gcc-ecbffdd88f3f073ded32f1cd632dfb1bfc5d7c38.tar.gz gcc-ecbffdd88f3f073ded32f1cd632dfb1bfc5d7c38.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/vec.c | 4 | ||||
-rw-r--r-- | gcc/vec.h | 6 |
3 files changed, 11 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 757eded..e388ec9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +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> PR middle-end/58941 @@ -187,9 +187,7 @@ vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve, num = pfx->m_num; } else if (!reserve) - /* If there's no vector, and we've not requested anything, then we - will create a NULL vector. */ - return 0; + gcc_unreachable (); /* We must have run out of room. */ gcc_assert (alloc - num < reserve); @@ -283,11 +283,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact { unsigned alloc = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact); - if (!alloc) - { - release (v); - return; - } + gcc_assert (alloc); if (GATHER_STATISTICS && v) v->m_vecpfx.release_overhead (); |