public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109353] FAIL: 23_containers/vector/bool/allocator/copy.cc (test for excess errors)
Date: Fri, 31 Mar 2023 10:16:52 +0000	[thread overview]
Message-ID: <bug-109353-4-9uQKck4JoA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109353-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This doesn't help:

--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -936,15 +936,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
          *__position = __x;
          ++this->_M_impl._M_finish;
        }
+      else if (!this->_M_impl._M_start._M_p)
+       {
+         _Bit_pointer __q = this->_M_allocate(1);
+         iterator __i(std::__addressof(*__q), 0);
+         this->_M_impl._M_end_of_storage = __q + 1;
+         this->_M_impl._M_start = __i;
+         *__i = __x;
+         this->_M_impl._M_finish = ++__i;
+       }
       else
        {
          const size_type __len =
            _M_check_len(size_type(1), "vector<bool>::_M_insert_aux");
+         const iterator __begin = begin(), __end = end();
          _Bit_pointer __q = this->_M_allocate(__len);
          iterator __start(std::__addressof(*__q), 0);
-         iterator __i = _M_copy_aligned(begin(), __position, __start);
+         iterator __i = _M_copy_aligned(__begin, __position, __start);
          *__i++ = __x;
-         iterator __finish = std::copy(__position, end(), __i);
+         iterator __finish = std::copy(__position, __end, __i);
          this->_M_deallocate();
          this->_M_impl._M_end_of_storage = __q + _S_nword(__len);
          this->_M_impl._M_start = __start;

  parent reply	other threads:[~2023-03-31 10:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  7:28 [Bug tree-optimization/109353] New: " rguenth at gcc dot gnu.org
2023-03-31  7:55 ` [Bug tree-optimization/109353] " rguenth at gcc dot gnu.org
2023-03-31  8:08 ` rguenth at gcc dot gnu.org
2023-03-31  8:15 ` rguenth at gcc dot gnu.org
2023-03-31 10:16 ` redi at gcc dot gnu.org [this message]
2023-03-31 11:57 ` rguenth at gcc dot gnu.org
2023-10-04 14:27 ` redi at gcc dot gnu.org

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=bug-109353-4-9uQKck4JoA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).