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)


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> Zack Weinberg <zack@codesourcery.com> writes:
> | Index: cp/search.c
> | --- cp/search.c	4 Nov 2002 01:45:55 -0000	1.240
> | +++ cp/search.c	14 Nov 2002 19:54:51 -0000
> | @@ -2544,7 +2544,8 @@ dfs_push_decls (binfo, data)
> |  	  
> |        method_vec = (CLASS_TYPE_P (type) 
> |  		    ? CLASSTYPE_METHOD_VEC (type) : NULL_TREE);
> | -      if (method_vec)
> | +
> | +      if (method_vec && TREE_VEC_LENGTH (method_vec) >= 3)
>
> I would probably put an assert here is if we have a method_vec then it
> size ought to be at least 3.

We get a method_vec of size 2 compiling libstdc++-v3:

/home/zack/src/gcc/vanilla/build/gcc/xgcc -shared-libgcc -B/home/zack/src/gcc/vanilla/build/gcc/ -nostdinc++ -L/home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/src -L/home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/home/zack/src/i/gcc_ni/i686-pc-linux-gnu/bin/ -B/home/zack/src/i/gcc_ni/i686-pc-linux-gnu/lib/ -isystem /home/zack/src/i/gcc_ni/i686-pc-linux-gnu/include -nostdinc++ -I/home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu -I/home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/include -I/home/zack/src/gcc/vanilla/libstdc++-v3/libsupc++ -I/home/zack/src/gcc/vanilla/libstdc++-v3/libmath -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -c /home/zack/src/gcc/vanilla/libstdc++-v3/src/bitset.cc  -fPIC -DPIC -o .libs/bitset.o
In file included from /home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/include/memory:55,
                 from /home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/include/string:48,
                 from /home/zack/src/gcc/vanilla/build/i686-pc-linux-gnu/libstdc++-v3/include/bitset:55,
                 from /home/zack/src/gcc/vanilla/libstdc++-v3/src/bitset.cc:43:
/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 
   cp/search.c:2556
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make[2]: *** [bitset.lo] Error 1

zw


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