public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio
@ 2004-08-10 9:31 peturr02 at ru dot is
2004-08-10 9:34 ` [Bug libstdc++/16959] " peturr02 at ru dot is
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: peturr02 at ru dot is @ 2004-08-10 9:31 UTC (permalink / raw)
To: gcc-bugs
In src/ios_init.cc:
bool
ios_base::sync_with_stdio(bool __sync)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 49. Underspecification of ios_base::sync_with_stdio
bool __ret = ios_base::Init::_S_synced_with_stdio;
// Turn off sync with C FILE* for cin, cout, cerr, clog iff
// currently synchronized.
if (!__sync && __ret)
{
ios_base::Init::_S_synced_with_stdio = __sync;
// Explicitly call dtors to free any memory that is
// dynamically allocated by filebuf ctor or member functions,
// but don't deallocate all memory by calling operator delete.
buf_cout_sync.~stdio_sync_filebuf<char>();
buf_cin_sync.~stdio_sync_filebuf<char>();
buf_cerr_sync.~stdio_sync_filebuf<char>();
This is fine, except that there is no guarantee that buf_cout_sync and friends
have been constructed before this gets run. If the objects haven't been
constructed, the program segfaults.
A simple fix would be to construct an ios_base::Init object at the beginning
of the block.
--
Summary: [3.4/3.5 Regression] Segmentation fault in
ios_base::sync_with_stdio
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/16959] [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio
2004-08-10 9:31 [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio peturr02 at ru dot is
@ 2004-08-10 9:34 ` peturr02 at ru dot is
2004-08-10 20:55 ` pcarlini at suse dot de
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: peturr02 at ru dot is @ 2004-08-10 9:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From peturr02 at ru dot is 2004-08-10 09:34 -------
Created an attachment (id=6910)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6910&action=view)
Test case
This works fine with 3.2.3 and 3.3.4, but segfaults with 3.4.1 and 3.5.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/16959] [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio
2004-08-10 9:31 [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio peturr02 at ru dot is
2004-08-10 9:34 ` [Bug libstdc++/16959] " peturr02 at ru dot is
@ 2004-08-10 20:55 ` pcarlini at suse dot de
2004-08-11 9:31 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pcarlini at suse dot de @ 2004-08-10 20:55 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
------- Additional Comments From pcarlini at suse dot de 2004-08-10 20:55 -------
Thanks, Pétur.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-08-10 20:55:19
date| |
Target Milestone|--- |3.4.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/16959] [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio
2004-08-10 9:31 [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio peturr02 at ru dot is
2004-08-10 9:34 ` [Bug libstdc++/16959] " peturr02 at ru dot is
2004-08-10 20:55 ` pcarlini at suse dot de
@ 2004-08-11 9:31 ` cvs-commit at gcc dot gnu dot org
2004-08-12 9:11 ` [Bug libstdc++/16959] [3.4 " cvs-commit at gcc dot gnu dot org
2004-08-12 9:12 ` pcarlini at suse dot de
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-11 9:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-08-11 09:31 -------
Subject: Bug 16959
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2004-08-11 09:31:13
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/src: ios_init.cc
Added files:
libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio: 16959.cc
Log message:
2004-08-11 Paolo Carlini <pcarlini@suse.de>
Petur Runolfsson <peturr02@ru.is>
PR libstdc++/16959
* src/ios_init.cc (ios_base::sync_with_stdio): Make sure the
standard streams are constructed.
* testsuite/27_io/ios_base/sync_with_stdio/16959.cc: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2603&r2=1.2604
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/ios_init.cc.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/16959] [3.4 Regression] Segmentation fault in ios_base::sync_with_stdio
2004-08-10 9:31 [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio peturr02 at ru dot is
` (2 preceding siblings ...)
2004-08-11 9:31 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-12 9:11 ` cvs-commit at gcc dot gnu dot org
2004-08-12 9:12 ` pcarlini at suse dot de
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-12 9:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-08-12 09:11 -------
Subject: Bug 16959
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: paolo@gcc.gnu.org 2004-08-12 09:11:08
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/src: ios_init.cc
Added files:
libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio: 16959.cc
Log message:
2004-08-12 Paolo Carlini <pcarlini@suse.de>
Petur Runolfsson <peturr02@ru.is>
PR libstdc++/16959
* src/ios_init.cc (ios_base::sync_with_stdio): Make sure the
standard streams are constructed.
* testsuite/27_io/ios_base/sync_with_stdio/16959.cc: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.151&r2=1.2224.2.152
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/ios_init.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.4.4.1&r2=1.4.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16959
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/16959] [3.4 Regression] Segmentation fault in ios_base::sync_with_stdio
2004-08-10 9:31 [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio peturr02 at ru dot is
` (3 preceding siblings ...)
2004-08-12 9:11 ` [Bug libstdc++/16959] [3.4 " cvs-commit at gcc dot gnu dot org
@ 2004-08-12 9:12 ` pcarlini at suse dot de
4 siblings, 0 replies; 6+ messages in thread
From: pcarlini at suse dot de @ 2004-08-12 9:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2004-08-12 09:12 -------
Fixed for mainline and 3.4.2.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16959
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-08-12 9:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 9:31 [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio peturr02 at ru dot is
2004-08-10 9:34 ` [Bug libstdc++/16959] " peturr02 at ru dot is
2004-08-10 20:55 ` pcarlini at suse dot de
2004-08-11 9:31 ` cvs-commit at gcc dot gnu dot org
2004-08-12 9:11 ` [Bug libstdc++/16959] [3.4 " cvs-commit at gcc dot gnu dot org
2004-08-12 9:12 ` pcarlini at suse dot de
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).