This is the mail archive of the
mailing list for the GCC project.
Re: Bounds checking for TREE_VEC_ELT and related bugs (PR c++/8511)
Gabriel Dos Reis wrote:
Graham Stott <email@example.com> writes:
You're absolutely correct.
I sent another message to correct my misconception (I can't tell where
I got the idea that we always have at least 3 slots, whereas in
reality it is at least 2).
However, what is worrying me in Zack's message is the following:
/home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/include/bits/stl_alloc.h:381: internal compiler error: tree
check: accessed elt 3 of tree_vec with 2 elts in dfs_push_decls, at
That is, in libstdc++, we're accessing one element behond the limit!
Yes it's accessing beyond the logical limit but not physical limit.
Note this bit code of code I quoted
/* Now sort the methods. */
while (len > 2 && TREE_VEC_ELT (method_vec, len-1) == NULL_TREE)
TREE_VEC_LENGTH (method_vec) = len;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here we shrink the vectors len