public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/113761] New: Abnormal program termination using libstdc++
@ 2024-02-05  8:38 arakawamasahiro at jp dot fujitsu.com
  2024-02-05  8:57 ` [Bug libstdc++/113761] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: arakawamasahiro at jp dot fujitsu.com @ 2024-02-05  8:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113761
           Summary: Abnormal program termination using libstdc++
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arakawamasahiro at jp dot fujitsu.com
  Target Milestone: ---

If you compile the following program with g++-11.4.0 and run it using libstdc++
12.3.0, the executable program will terminate abnormally.

[program(test.cpp)]
#include <iostream>

#include <random>
#include <cassert>

double f(double x)
{
    return x*2;
}

int main()
{
    typedef std::piecewise_constant_distribution<> D;
    D d({}, f);
    std::vector<double> iv = d.intervals();

    return 0;
}

[Compile and execute log]
$ g++ test.cpp
$ LANG=C; ./a.out
terminate called after throwing an instance of 'std::length_error'
  what():  vector::reserve
Aborted (core dumped)

The {} specified in the first argument of variable d in the std::
piecewise_constant_distribution<> class reduces the list size to 0.
Given the constraints of the constructor of the std::
piecewise_constant_distribution<> class, you should expect a pattern where the
list size is zero.

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

end of thread, other threads:[~2024-02-05 11:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05  8:38 [Bug libstdc++/113761] New: Abnormal program termination using libstdc++ arakawamasahiro at jp dot fujitsu.com
2024-02-05  8:57 ` [Bug libstdc++/113761] " pinskia at gcc dot gnu.org
2024-02-05  9:00 ` pinskia at gcc dot gnu.org
2024-02-05  9:03 ` [Bug libstdc++/113761] piecewise_constant_distribution's initializer_list constructor is not correct for `size < 2` pinskia at gcc dot gnu.org
2024-02-05 10:55 ` redi at gcc dot gnu.org
2024-02-05 11:32 ` redi at gcc dot gnu.org
2024-02-05 11:51 ` pinskia 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).