This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Diego Novillo <dnovillo at google dot com>
- Cc: libstdc++ at gcc dot gnu dot org, reply at codereview dot appspotmail dot com, gcc-patches at gcc dot gnu dot org
- Date: Tue, 6 Sep 2011 11:01:10 -0700
- Subject: Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
- References: <20110906162854.5C60B190B10@elbrus2.mtv.corp.google.com> <CAD_=9DQTK4-aZKNV6c68HK+zsHNFQtKTrcztEEb1oMF-TvEdBg@mail.gmail.com> <CALoOobNLK-x0BsQ5qcJQUXA_iOkh7E3rynSyJt96wTLyvQNqhg@mail.gmail.com> <CAD_=9DQQjTwSM5siBan7-36Vz9-xjLMc5-SgWHr1sFWW9RN1zA@mail.gmail.com>
On Tue, Sep 6, 2011 at 10:46 AM, Diego Novillo <dnovillo@google.com> wrote:
> On Tue, Sep 6, 2011 at 12:54, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
>> On Tue, Sep 6, 2011 at 9:44 AM, Diego Novillo <dnovillo@google.com> wrote:
>>
>>> OK. ?Any reason not to send this (or a variant) to mainline?
>>
>> AFAIU, mainline is not interested -- there is already a debug mode (enabled
>> by _GLIBCXX_DEBUG), which catches many of the same bugs (and more), and
>> introduction of "parallel" debug modes is undesirable.
>>
>> Unfortunately, _GLIBCXX_DEBUG makes no performance guarantees (making some
>> normally constant-time operations O(N), etc.) and so we can't just turn
>> it on in Google.
>
> Right. ?That's why I thought of a variant. ?Maybe we want to have
> levels of checking, or a _GLBICXX_DEBUG_FAST.
Which would introduce a "parallel" debug mode ... which has been rejected
in the past.
> But this is something to discuss with libstdc++ (CC'd).
Sure. If the "parallel" debug mode is more tenable now, I am all for it.
To give some context, in a large code base (> 1e6 lines of C++ code),
the checks added in this patch found 20 bugs.
Most (though not all) of these bugs could also have been found with Valgrind
and (probably) with _GLIBCXX_DEBUG, but the runtime cost of running such
heavy-weight checks over the entire code base is prohibitive.
Thanks,
--
Paul Pluzhnikov