aboutsummaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-11-27 10:36:20 +0100
committerMartin Liska <marxin@gcc.gnu.org>2015-11-27 09:36:20 +0000
commitb58d3df29fd0c37a2d5115fc9c708cffcc379ffc (patch)
treedd1adb68f7048a3707687ccc46f906e3f92b822d /gcc/vec.h
parent4d95edca1212e23855e4f613b588cbc6dac89999 (diff)
downloadgcc-b58d3df29fd0c37a2d5115fc9c708cffcc379ffc.zip
gcc-b58d3df29fd0c37a2d5115fc9c708cffcc379ffc.tar.gz
gcc-b58d3df29fd0c37a2d5115fc9c708cffcc379ffc.tar.bz2
Fix memory leak in cilk
PR c++/68312 * c-array-notation.c (fix_builtin_array_notation_fn): Use release_vec_vec instead of vec::release. (build_array_notation_expr): Likewise. (fix_conditional_array_notations_1): Likewise. (fix_array_notation_expr): Likewise. (fix_array_notation_call_expr): Likewise. PR c++/68312 * cp-array-notation.c (expand_sec_reduce_builtin): Likewise. (create_array_refs): Replace argument with const reference. (expand_an_in_modify_expr): Likewise. (cp_expand_cond_array_notations): Likewise. (expand_unary_array_notation_exprs): Likewise. PR c++/68312 * array-notation-common.c (cilkplus_extract_an_triplets): Release vector of vectors. * cilk.c (gimplify_cilk_spawn): Free allocated memory. PR c++/68312 * vec.h (release_vec_vec): New function. From-SVN: r231001
Diffstat (limited to 'gcc/vec.h')
-rw-r--r--gcc/vec.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index 3e6e882..ed300b4 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1702,6 +1702,18 @@ vec<T, va_heap, vl_ptr>::using_auto_storage () const
return m_vec->m_vecpfx.m_using_auto_storage;
}
+/* Release VEC and call release of all element vectors. */
+
+template<typename T>
+inline void
+release_vec_vec (vec<vec<T> > &vec)
+{
+ for (unsigned i = 0; i < vec.length (); i++)
+ vec[i].release ();
+
+ vec.release ();
+}
+
#if (GCC_VERSION >= 3000)
# pragma GCC poison m_vec m_vecpfx m_vecdata
#endif