This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Library bug - Problem with string(string::reverse_iterator, string::reverse_iterator)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]