[Bug libstdc++/90857] stl::forward_list::erase_after crashes if __pos == __last

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 12 14:03:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90857

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2019-06-12
         Resolution|INVALID                     |---
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Jose Dapena Paz from comment #0)
> > As far as I know, the specification does not really say this is a valid
> > case.
> 
> It explicitly says it's NOT valid:
> 
>  Expects: The iterator following position is dereferenceable.
> 

Sorry, I copied the wrong paragraph. The relevant one is:

 Expects: All iterators in the range (position, last) are dereferenceable.

The range (position, last) is a closed interval, which we've interpreted to
mean  that the range [position+1,last) must be valid. But I see your point,
that it could also be interpreted to mean that pos==last is a no-op.

I'll confirm this and consider it further.


More information about the Gcc-bugs mailing list