From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 96E563858C54; Mon, 5 Feb 2024 08:38:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96E563858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707122326; bh=LHy+hMqmdK7EDArU5IVVGGsq7QJtb1fof1+oPoHXoKU=; h=From:To:Subject:Date:From; b=n96VqxFkz3MGoTkpE+f9AboP0Ih1XnmmlwTCqMl+IqUrCpSQsgCTWBm2pYgLKtlk2 481spR3MjyNJefoBuQdwGNsrMt9taIBSWBbbm81RV09nXMagC7k87KUArMuvSSFsoO GHU7c/DJT9ciD9ql0VOZba9yReAUtRyf/MEflLbQ= From: "arakawamasahiro at jp dot fujitsu.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113761] New: Abnormal program termination using libstdc++ Date: Mon, 05 Feb 2024 08:38:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: arakawamasahiro at jp dot fujitsu.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113761 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 libst= dc++ 12.3.0, the executable program will terminate abnormally. [program(test.cpp)] #include #include #include double f(double x) { return x*2; } int main() { typedef std::piecewise_constant_distribution<> D; D d({}, f); std::vector iv =3D d.intervals(); return 0; } [Compile and execute log] $ g++ test.cpp $ LANG=3DC; ./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.=