aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2002-11-14 21:58:38 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-11-14 21:58:38 +0000
commitfa7b533b7b995fce50516c78d0a9dcbcaa437124 (patch)
tree30bf88ca9d454be99af8fdef0fb816fd40bdf399 /gcc/tree-inline.c
parent9fc910d1ea18fde1720eaa8277d4ce6158772426 (diff)
downloadgcc-fa7b533b7b995fce50516c78d0a9dcbcaa437124.zip
gcc-fa7b533b7b995fce50516c78d0a9dcbcaa437124.tar.gz
gcc-fa7b533b7b995fce50516c78d0a9dcbcaa437124.tar.bz2
tree.c (tree_vec_elt_check_failed): New function.
* tree.c (tree_vec_elt_check_failed): New function. * tree.h (TREE_VEC_ELT_CHECK): New checking macro. (TREE_VEC_ELT): Use it. * tree-inline.c (optimize_inline_calls): Don't copy a zero-length vector. cp: * search.c (dfs_push_decls): Do not try to reorder elements 3..n of method_vec if method_vec has only two elements. Reverse order of two tests to avoid accessing unallocated memory. From-SVN: r59114
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 898dacb..362ddd1 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1367,8 +1367,9 @@ optimize_inline_calls (fn)
{
tree ifn = make_tree_vec (VARRAY_ACTIVE_SIZE (id.inlined_fns));
- memcpy (&TREE_VEC_ELT (ifn, 0), &VARRAY_TREE (id.inlined_fns, 0),
- VARRAY_ACTIVE_SIZE (id.inlined_fns) * sizeof (tree));
+ if (VARRAY_ACTIVE_SIZE (id.inlined_fns))
+ memcpy (&TREE_VEC_ELT (ifn, 0), &VARRAY_TREE (id.inlined_fns, 0),
+ VARRAY_ACTIVE_SIZE (id.inlined_fns) * sizeof (tree));
DECL_INLINED_FNS (fn) = ifn;
}
}