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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
        _GLIBCXX20_CONSTEXPR
        _Bit_type*
        _M_end_addr() const _GLIBCXX_NOEXCEPT
        {
          if (this->_M_end_of_storage)
            return std::__addressof(this->_M_end_of_storage[-1]) + 1;
          return 0;
        }

...
      _GLIBCXX20_CONSTEXPR
      void
      _M_deallocate()
      {
        if (_M_impl._M_start._M_p)
          {
            const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p;
            _Bit_alloc_traits::deallocate(_M_impl,
                                          _M_impl._M_end_of_storage - __n,
                                          __n);
            _M_impl._M_reset();
          }
      }
```

I don't get why we just don't call _Bit_alloc_traits::deallocate on
_M_impl._M_start._M_p here instead of `_M_impl._M_end_of_storage - __n`. Unless
I am missing something with respect to allocator traits.

That was changed with r5-4575-gccd615e3fdf2d2 ; which was the move to support
C++11 allocator requirements. But I would expect all allocators should produce
`e - (e - b)` as being b always. and `_M_end_of_storage  - __n` I would hope
being always _M_impl._M_start._M_p too. Unless I miss something here.

Reply via email to