This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: vector lightweight debug mode
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 7 Oct 2015 21:09:17 +0100
- Subject: Re: vector lightweight debug mode
- Authentication-results: sourceware.org; auth=none
- References: <55F71189 dot 8080006 at gmail dot com> <20150914195038 dot GQ2631 at redhat dot com> <55F9C4F6 dot 6030706 at gmail dot com> <20150916202953 dot GE2631 at redhat dot com> <55FD0F35 dot 4010106 at gmail dot com> <CAH6eHdSzU-HB_0R82HDdFkHy3tMraDw+OGU8AfTY7Gqx8MSMGA at mail dot gmail dot com> <CAH6eHdSR-GM2uYUOyxmi6voLOn1CreSFp=tVRJigf9oSDCZ_dQ at mail dot gmail dot com> <561574BE dot 1060005 at gmail dot com>
On 07/10/15 21:38 +0200, François Dumont wrote:
Hi
I completed vector assertion mode. Here is the result of the new
test you will find in the attached patch.
With debug mode:
/home/fdt/dev/gcc/build_git/x86_64-unknown-linux-gnu/libstdc++-v3/include/debug/safe_iterator.h:375:
Error: attempt to advance a dereferenceable (start-of-sequence) iterator 2
steps, which falls outside its valid range.
Objects involved in the operation:
iterator @ 0x0x7fff1c346760 {
type =
__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*,
std::__cxx1998::vector<int, std::allocator<int> > >,
std::__debug::vector<int, std::allocator<int> > > (mutable iterator);
state = dereferenceable (start-of-sequence);
references sequence with type 'std::__debug::vector<int,
std::allocator<int> >' @ 0x0x7fff1c3469a0
}
XFAIL: 23_containers/vector/debug/insert8_neg.cc execution test
With assertion mode:
/home/fdt/dev/gcc/build_git/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stl_vector.h:1124:
Error: invalid insert position outside container [begin, end) range.
Objects involved in the operation:
sequence "this" @ 0x0x7fff60b1f870 {
type = std::vector<int, std::allocator<int> >;
}
iterator "__position" @ 0x0x7fff60b1f860 {
type = __gnu_cxx::__normal_iterator<int const*, std::vector<int,
std::allocator<int> > >;
}
XFAIL: 23_containers/vector/debug/insert8_neg.cc execution test
I still don't like the formatted output for the lightweight mode, it
adds a dependency on I/O support in libc, which is a problem for
embedded systems.
The idea was to just add really cheap checks and abort :-(
Have you compared codegen with and without assertion mode? How much
more code is added to member functions like operator[] that must be
inlined for good performance? Is it likely to affect inlining
decisions?
I suspect it will have a much bigger impact than if we just use
__builtin_abort() as I made it do originally.
If these checks become more complex then people are not going to
enable them by default, and we probably won't want to make them
enabled by _FORTIFY_SOURCE.