On EuroLLVM 2014 Kostya Serebryany presented a way for vector overflow detection. On slide 12 he presents a link to GCC revision 207517 where one can see branches/google/gcc-4_8/libstdc++-v3/
.
I wonder on which GCC version I can use Container Overflow Bugs detection?
If it is only in trunk is it avaliable in Clang 3.9 release or it is also in trunk?

- 772
- 10
- 62
- 134
-
I have a funy problem - there is some kind of Container Overflow Bugs detection that is presented and forced in MSVC 2015. In versions compiled with it all our Unit tests fail... so I need to convince Linux (where this bugs do not surface) developers that it is not a Windows problem, but a code bug they need to fix. – DuckQueen Jul 17 '16 at 19:58
-
1You should edit the question to include this information instead of commenting under it. – Borgleader Jul 17 '16 at 20:01
-
Does [this](http://stackoverflow.com/a/24247724/3002139) help? – Baum mit Augen Jul 17 '16 at 20:06
-
@BaummitAugen: There is no info to which minimal GCC version it is related. – DuckQueen Jul 17 '16 at 20:15
-
@Borgleader: IMHO its more a fun-fact than question related info... – DuckQueen Jul 17 '16 at 20:16
-
@DuckQueen Cannot see that in the docs, but I never heard of that being new, so it's probably old. 4.8 certainly has it, I already used it back then. – Baum mit Augen Jul 17 '16 at 20:18
-
How could you use it if commit added vector annotations only 2 years ago to gcc 4.8 google branch? – DuckQueen Jul 17 '16 at 21:02
-
1@DuckQueen I wasn't using that google thing, but the thing from the link (which also checks for out-of-bound access etc on standard library containers). Btw, you should @ ping me when replying to me, I saw that by pure chance. – Baum mit Augen Jul 17 '16 at 23:48
1 Answers
Sanitizer vector annotations are not available in original gcc, the changes are only part of google's branch of gcc (published at gcc.gnu.org). Description of branches: https://www.gnu.org/software/gcc/svn.html
google/main
This branch contains Google local patches that are staged to be contributed to trunk. Some of these patches are either in the process of being reviewed, or have not yet been proposed. The intent of this branch is to serve as a staging platform to allow collaboration with external developers. Patches in this branch are only expected to remain here until they are reviewed and accepted in trunk. This branch is maintained by Diego Novillo
Commit of adding AddressSanitizer annotations to vector:
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=207517 "For Google b/8513090, add AddressSanitizer annotations to std::vector":
We can get names of annotations from the commit:
// When sanitizer annotataions are off, avoid bazillion of no-op
// functions that blow up debug binary size.
#define __sanitizer_vector_annotate_new()
#define __sanitizer_vector_annotate_delete()
#define __sanitizer_vector_annotate_increase(a)
#define __sanitizer_vector_annotate_shrink(a)
There are no sanitizer annotations in GNU's trunk version of vector.tcc or stl_vector.h now (search for "sanitizer"):
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/vector.tcc https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_vector.h
Thread in mailing list gcc-patches: https://gcc.gnu.org/ml/gcc-patches/2014-05/msg02180.html "detecting "container overflow" bugs in std::vector", From: Konstantin Serebryany, 26 May 2014.

- 90,338
- 53
- 357
- 513