From 27a7de71c70787a522bd0706dbcbe95311bde552 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 15 Dec 2014 14:24:06 +0000 Subject: [PATCH] vec.h (vec::safe_grow): Guard against a grow to zero size. 2014-12-15 Richard Biener * vec.h (vec::safe_grow): Guard against a grow to zero size. From-SVN: r218749 --- gcc/ChangeLog | 4 ++++ gcc/vec.h | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e3eda67b24..90075639ab8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2014-12-15 Richard Biener + + * vec.h (vec::safe_grow): Guard against a grow to zero size. + 2014-12-15 Richard Biener PR middle-end/64295 diff --git a/gcc/vec.h b/gcc/vec.h index 2e5313dd146..ca568accdcf 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -1574,7 +1574,10 @@ vec::safe_grow (unsigned len MEM_STAT_DECL) unsigned oldlen = length (); gcc_checking_assert (oldlen <= len); reserve_exact (len - oldlen PASS_MEM_STAT); - m_vec->quick_grow (len); + if (m_vec) + m_vec->quick_grow (len); + else + gcc_checking_assert (len == 0); } -- 2.30.2