From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22695 invoked by alias); 10 Aug 2004 09:31:21 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 22686 invoked by uid 48); 10 Aug 2004 09:31:19 -0000 Date: Tue, 10 Aug 2004 09:31:00 -0000 From: "peturr02 at ru dot is" To: gcc-bugs@gcc.gnu.org Message-ID: <20040810093113.16959.peturr02@ru.is> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/16959] New: [3.4/3.5 Regression] Segmentation fault in ios_base::sync_with_stdio X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg00780.txt.bz2 List-Id: 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(); buf_cin_sync.~stdio_sync_filebuf(); buf_cerr_sync.~stdio_sync_filebuf(); 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