public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105324] New: std::from_chars() assertion at floating_from_chars.cc:78 when parsing 1.11111111....
@ 2022-04-21  1:40 nishida_kenji at nintendo dot co.jp
  2022-04-21  9:24 ` [Bug c++/105324] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: nishida_kenji at nintendo dot co.jp @ 2022-04-21  1:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105324
           Summary: std::from_chars() assertion at
                    floating_from_chars.cc:78 when parsing 1.11111111....
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nishida_kenji at nintendo dot co.jp
  Target Milestone: ---

CODE:
--------
#include <memory>
#include <charconv>
#include <cstring>
#include <cstdio>

int main() {
#ifdef __GLIBCXX__
    std::printf("GLIBCXX: %d\n",__GLIBCXX__);
#endif
    std::unique_ptr<char[]> mem(new char[1024 * 128]);
    std::memset(mem.get(), '1', 10000);
    mem[1]     = '.';
    mem[511] = '\0';
    double val;
    std::from_chars(mem.get(), mem.get() + 511, val);
    std::printf("511: %f\n", val);

    std::memset(mem.get(), '1', 10000);
    mem[1]     = '.';
    mem[512] = '\0';
    std::from_chars(mem.get(), mem.get() + 512, val);
    std::printf("512: %f\n", val);
    return 0;
}
---
RESULT:
GLIBCXX: 20220127
511: 1.111111
../../../../../libstdc++-v3/src/c++17/floating_from_chars.cc:78: virtual void*
std::{anonymous}::buffer_resource::do_allocate(std::size_t, std::size_t):
Assertion 'alignment != 1' failed.

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

end of thread, other threads:[~2022-05-06 10:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21  1:40 [Bug c++/105324] New: std::from_chars() assertion at floating_from_chars.cc:78 when parsing 1.11111111 nishida_kenji at nintendo dot co.jp
2022-04-21  9:24 ` [Bug c++/105324] " redi at gcc dot gnu.org
2022-04-21 10:34 ` cvs-commit at gcc dot gnu.org
2022-04-21 12:34 ` cvs-commit at gcc dot gnu.org
2022-04-21 12:38 ` redi at gcc dot gnu.org
2022-05-02 21:43 ` aoliva at gcc dot gnu.org
2022-05-02 21:53 ` redi at gcc dot gnu.org
2022-05-03 17:58 ` [Bug libstdc++/105324] " cvs-commit at gcc dot gnu.org
2022-05-06 10:27 ` cvs-commit at gcc dot gnu.org
2022-05-06 10:34 ` cvs-commit at gcc dot gnu.org
2022-05-06 10:37 ` [Bug c++/105324] " aoliva 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).