public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sbergman at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/103022] New: std::begin on empty std::valarray causes _GLIBCXX_DEBUG assertion
Date: Mon, 01 Nov 2021 10:42:17 +0000	[thread overview]
Message-ID: <bug-103022-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 103022
           Summary: std::begin on empty std::valarray causes
                    _GLIBCXX_DEBUG assertion
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

At least with GCC 11.2.1:

> $ cat test.cc
> #include <valarray>
> int main() {
>     std::valarray<double> v;
>     std::begin(v);
> }

> $ g++ -D_GLIBCXX_DEBUG test.cc
> $ ./a.out
> /usr/include/c++/11/valarray:594: _Tp& std::valarray<_Tp>::operator[](std::size_t) [with _Tp = double; std::size_t = long unsigned int]: Assertion '__i < this->size()' failed.
> Aborted

because the std::begin overload is implemented via

  return std::__addressof(__va[0]);

ever since
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f67a9881a86bcdeb67fa52c0a8eb45ce9d4134d4>
"[multiple changes]" and the std::valarray subscript operator calls

  __glibcxx_requires_subscript(__i);

ever since
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=285b36d6a58c08792e78f9fedb3f84bdba3a4eee>
"[multiple changes]".

(See
<https://git.libreoffice.org/core/+/82047d042e9d5d24b334eba63fd7e4c5bbbb022e%5E%21>
"crashtesting: assert on conversion of fdo67521-1.odg to pdf" for an issue this
caused in LibreOffice.)

             reply	other threads:[~2021-11-01 10:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 10:42 sbergman at redhat dot com [this message]
2021-11-01 10:56 ` [Bug libstdc++/103022] " redi at gcc dot gnu.org
2021-11-01 13:26 ` cvs-commit at gcc dot gnu.org
2021-11-01 19:14 ` cvs-commit at gcc dot gnu.org
2021-11-01 20:18 ` cvs-commit at gcc dot gnu.org
2021-11-01 20:58 ` cvs-commit at gcc dot gnu.org
2021-11-01 20:59 ` 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-103022-4@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).