public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/103022] New: std::begin on empty std::valarray causes _GLIBCXX_DEBUG assertion
@ 2021-11-01 10:42 sbergman at redhat dot com
  2021-11-01 10:56 ` [Bug libstdc++/103022] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sbergman at redhat dot com @ 2021-11-01 10:42 UTC (permalink / raw)
  To: gcc-bugs

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.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-01 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 10:42 [Bug libstdc++/103022] New: std::begin on empty std::valarray causes _GLIBCXX_DEBUG assertion sbergman at redhat dot com
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

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).