public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108214] New: writinng bitset to stringstream fails
@ 2022-12-23 17:07 rhalbersma at gmail dot com
2022-12-23 17:22 ` [Bug libstdc++/108214] [13 Regression] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: rhalbersma at gmail dot com @ 2022-12-23 17:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108214
Bug ID: 108214
Summary: writinng bitset to stringstream fails
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rhalbersma at gmail dot com
Target Milestone: ---
#include <bitset>
#include <sstream>
int main() {
using T = std::bitset<1>;
T a(1);
T b;
std::stringstream sstr;
sstr << a;
sstr >> b;
}
The above program works correctly for g++ until version 12, but for version 13
(trunk) it errors out with: "terminate called after throwing an instance of
'std::invalid_argument' what(): bitset::_M_copy_from_ptr"
Godbolt link: https://godbolt.org/z/nnKT6cddb
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/108214] [13 Regression] writinng bitset to stringstream fails
2022-12-23 17:07 [Bug c++/108214] New: writinng bitset to stringstream fails rhalbersma at gmail dot com
@ 2022-12-23 17:22 ` pinskia at gcc dot gnu.org
2022-12-23 23:43 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-23 17:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108214
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-12-23
Ever confirmed|0 |1
Target Milestone|--- |13.0
Summary|writinng bitset to |[13 Regression] writinng
|stringstream fails |bitset to stringstream
| |fails
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect r13-2998-g1c12a3cfdfabf6 is causing this.
Confirmed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/108214] [13 Regression] writinng bitset to stringstream fails
2022-12-23 17:07 [Bug c++/108214] New: writinng bitset to stringstream fails rhalbersma at gmail dot com
2022-12-23 17:22 ` [Bug libstdc++/108214] [13 Regression] " pinskia at gcc dot gnu.org
@ 2022-12-23 23:43 ` redi at gcc dot gnu.org
2023-01-06 14:11 ` cvs-commit at gcc dot gnu.org
2023-01-06 14:12 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-23 23:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108214
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/108214] [13 Regression] writinng bitset to stringstream fails
2022-12-23 17:07 [Bug c++/108214] New: writinng bitset to stringstream fails rhalbersma at gmail dot com
2022-12-23 17:22 ` [Bug libstdc++/108214] [13 Regression] " pinskia at gcc dot gnu.org
2022-12-23 23:43 ` redi at gcc dot gnu.org
@ 2023-01-06 14:11 ` cvs-commit at gcc dot gnu.org
2023-01-06 14:12 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-06 14:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108214
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:553332c19a04ad0a6bbdd2aafc3499a1cb4dfa0c
commit r13-5048-g553332c19a04ad0a6bbdd2aafc3499a1cb4dfa0c
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Jan 6 13:42:07 2023 +0000
libstdc++: Fix misuse of alloca in std::bitset [PR108214]
The use of alloca in a constructor is wrong, because the memory is gone
after the constructor returns, and will be overwritten by a subsequent
function call. This didn't show up in testing because function inlining
alters the stack usage.
libstdc++-v3/ChangeLog:
PR libstdc++/108214
* include/std/bitset (operator>>): Use alloca in the right
scope, not in a constructor.
* testsuite/20_util/bitset/io/input.cc: Check case from PR.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/108214] [13 Regression] writinng bitset to stringstream fails
2022-12-23 17:07 [Bug c++/108214] New: writinng bitset to stringstream fails rhalbersma at gmail dot com
` (2 preceding siblings ...)
2023-01-06 14:11 ` cvs-commit at gcc dot gnu.org
@ 2023-01-06 14:12 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-06 14:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108214
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Dumb mistake fixed, thanks for the report!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-06 14:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 17:07 [Bug c++/108214] New: writinng bitset to stringstream fails rhalbersma at gmail dot com
2022-12-23 17:22 ` [Bug libstdc++/108214] [13 Regression] " pinskia at gcc dot gnu.org
2022-12-23 23:43 ` redi at gcc dot gnu.org
2023-01-06 14:11 ` cvs-commit at gcc dot gnu.org
2023-01-06 14:12 ` 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).