public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ensadc at mailnesia dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/97828] std::ranges::search_n does not work with counted_iterator<_List_iterator<...>>
Date: Mon, 16 Nov 2020 11:24:34 +0000	[thread overview]
Message-ID: <bug-97828-4-RUqkpPVW0O@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97828-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from ensadc at mailnesia dot com ---
Compilation failure with `std::list`: https://godbolt.org/z/vbqhax

Wrong result with `std::vector`: https://godbolt.org/z/axYbYr (expected output:
"42 42 42"; actual: "42 0 42")

It appears that `__remainder` is not reset when the sequence of equal values is
interrupted. When the algorithm sees `0, 42, 42`, it decrements `__remainder`
to 1, but when it sees that the next value is 0, it does not increment
`__remainder`.

  reply	other threads:[~2020-11-16 11:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 15:32 [Bug libstdc++/97828] New: " ensadc at mailnesia dot com
2020-11-16 11:24 ` ensadc at mailnesia dot com [this message]
2020-11-16 11:34 ` [Bug libstdc++/97828] " ensadc at mailnesia dot com
2020-11-16 16:06 ` space.mission at yandex dot ru
2020-11-16 16:33 ` redi at gcc dot gnu.org
2020-11-16 16:36 ` redi at gcc dot gnu.org
2020-11-16 17:22 ` ppalka at gcc dot gnu.org
2020-11-16 20:26 ` ppalka at gcc dot gnu.org
2020-11-17 15:29 ` cvs-commit at gcc dot gnu.org
2020-11-17 16:28 ` cvs-commit at gcc dot gnu.org
2020-11-17 16:30 ` ppalka 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-97828-4-RUqkpPVW0O@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).