From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15315 invoked by alias); 6 Feb 2006 12:44:59 -0000 Received: (qmail 15306 invoked by uid 48); 6 Feb 2006 12:44:54 -0000 Date: Mon, 06 Feb 2006 12:44:00 -0000 Subject: [Bug libstdc++/26123] New: Segmentation fault in constructor of std::ostream::sentry::sentry X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "broeni at osb-systems dot com" 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 X-SW-Source: 2006-02/txt/msg00476.txt.bz2 List-Id: When compiled with: g++-4.0 -g -Wall -c -o try.o try.cc g++-4.0 -g -Wall -c -o foo.o foo.cc g++-4.0 -g -Wall -o try try.o foo.o the program below creates a segmentation fault. UNIX> gdb ./try (gdb) r Starting program: /data/home/osb/temp/clcpp/try Program received signal SIGSEGV, Segmentation fault. 0xb7f83de5 in std::ostream::sentry::sentry () from /usr/lib/libstdc++.so.6 try.h ===== #ifndef TRY_H #define TRY_H int mkCint(); const int cInt = mkCint(); #endif try.cc ====== #include "try.h" #include int main() { std::cout << cInt << std::endl; } int mkCint() { std::cout << "mkCint()" << std::endl; return 2; } foo.cc ====== #include "try.h" Notes If stdout instead of std::cout is used OR if compiled with g++-3.3 the program runs as expected: UNIX> ./try mkCint() mkCint() 2 UNIX> -- Summary: Segmentation fault in constructor of std::ostream::sentry::sentry Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: major Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: broeni at osb-systems dot com GCC build triplet: i486-pc-linux-gnu GCC host triplet: i486-pc-linux-gnu GCC target triplet: i486-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26123