This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Library bug - Problem with string(string::reverse_iterator, string::reverse_iterator)
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: Ryszard dot Kabatek at softax dot pl, libstdc++ at gcc dot gnu dot org, bkoz at nabi dot net, bkoz <bkoz at redhat dot com>
- Date: 04 Jun 2002 16:07:59 +0200
- Subject: Re: Library bug - Problem with string(string::reverse_iterator, string::reverse_iterator)
- Organization: CodeSourcery, LLC
- References: <3CFCBFD6.8080400@unitus.it>
Paolo Carlini <pcarlini@unitus.it> writes:
| Hi all, hi Benjamin,
|
| indeed I could reproduce the produce and I'm convinced it is regression
| wrt 3.0.4 which must be fixed ASAP.
|
| I could also confirm that the problem is due to this check:
|
| // NB: Not required, but considered best practice.
| if (__builtin_expect(__beg == _InIter(0), 0))
^^^^^^^^^^
I think Benjamin wanted to say
__beg == _InIter()
Patch pre-approved for both mainline and branch.
[...]
| Benjamin, could you possibly explain to me a bit the structure of that
| kind of check? We should find a way to modify it to work well also with
| reverse_iterator, IMO.
The sanity check is there to catch non-sensical data; since that isn't
exptected to happen frequently it was suggested to use the
__builtin_expect() to instruct the optimizer to do its best about that
check.
-- Gaby