public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	       "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
	       gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: vector lightweight debug mode
Date: Wed, 18 Nov 2015 12:27:00 -0000	[thread overview]
Message-ID: <20151118122744.GC25025@redhat.com> (raw)
In-Reply-To: <564B84C3.3090900@gmail.com>

On 17/11/15 20:49 +0100, François Dumont wrote:
>On 16/11/2015 11:29, Jonathan Wakely wrote:
>> Not doing the checks is also an option. That minimizes the cost :-)
>
>This is controlled by a macro, users already have this option.

True, but we're talking about maybe enabling these checks by default
when building linux distributions.

>>
>> For the full debug mode we want to check everything we can, and accept
>> that has a cost.
>>
>> For the lightweight one we need to evaluate the relative benefits. Is
>> it worth adding checks for errors that only happen rarely? Does the
>> benefit outweigh the cost?
>>
>> I'm still not convinced that's the case for the "valid range" checks.
>> I'm willing to be convinced, but am not convinced yet.
>
>Ok so I will remove this check. And what about insert position check ? I
>guess this one too so I will remove it too. Note that will only remain
>checks on the most basic operations that is to say those on which the
>check will have the biggest impact proportionally.

Yes, that's a good point.

But my unproven assumption is that it's more common to use operator[]
incorrectly, rather than pass invalid iterators to range insert, which
is a relatively "advanced" operation.


>I would like we push the simplest version so that people can start
>experimenting.
>
>I would also prefer concentrate on _GLIBCXX_DEBUG mode :-)
>
>>
>>>    It would be great to have it for gcc 6.0. I am working on the same
>>> for other containers.
>>
>> Please don't do the valid range checks for std::deque, the checks are
>> undefined for iterators into different containers and will not give a
>> reliable answer.
>
>But debug mode is full of those checks, no ?

They're supposed to be guarded by checks for _M_can_compare, if they
aren't that's a regression. For debug mode we can tell whether two
iterators are comparable, because they store a pointer back to their
parent container. We can't check that in normal mode.

  reply	other threads:[~2015-11-18 12:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 18:30 François Dumont
2015-09-14 19:55 ` Jonathan Wakely
2015-09-16 19:43   ` François Dumont
2015-09-16 20:53     ` Jonathan Wakely
     [not found]       ` <CA+jCFLueUi0Zo4m2D-scXNG5JLVSObKbJgXWaQRJrQ+notbXzg@mail.gmail.com>
2015-09-17 21:14         ` Fwd: " Christopher Jefferson
2015-09-19  9:12           ` Jonathan Wakely
2015-09-19  9:09       ` François Dumont
2015-09-19  9:48         ` Jonathan Wakely
2015-09-19 12:00           ` Jonathan Wakely
2015-10-07 19:38             ` François Dumont
2015-10-07 20:09               ` Jonathan Wakely
2015-10-12 19:43                 ` François Dumont
2015-11-15 21:12                   ` François Dumont
2015-11-16 10:29                     ` Jonathan Wakely
2015-11-17 19:49                       ` François Dumont
2015-11-18 12:27                         ` Jonathan Wakely [this message]
2015-11-18 12:34                           ` Jonathan Wakely
2015-11-19 21:17                           ` François Dumont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151118122744.GC25025@redhat.com \
    --to=jwakely@redhat.com \
    --cc=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).