This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bounds checking for TREE_VEC_ELT and related bugs (PR c++/8511)




--On Thursday, November 14, 2002 11:10:52 PM +0100 Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

Mark Mitchell <mark@codesourcery.com> writes:

| People may do "one past the end" tricks with TREE_VECs, just as they do
| with C arrays; we can decide if we like that or not.  If nobody does it
| now, except for that one C++ case, we can say that it's not allowed.


I would strongly lean toward not allowing it.  If we want to get the
address the of one-past-the-end then, I think, a canonical way to do
it is array + length, or in this particular case

    &TREE_VEC_LENGTH (array) + length
I agree; that's better.

OK, let's definitively not allow TREE_VEC_ELT with an index that doesn't
fit.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]