This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Serious breakage of fstream(s) ?!?
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: libstdc++ at gcc dot gnu dot org
- Cc: bkoz at redhat dot com
- Date: Fri, 18 Jan 2002 19:12:56 +0100
- Subject: Serious breakage of fstream(s) ?!?
Hi all, hi Benjamin,
today I'm seeing a new, serious problem when using fstream(s) on my
i686-pc-linux-gnu system (plain glibc2.2.4 -> generic_locale)
The testcase is the following (extracted from libstdc++/5424, which, in itself,
should not be very serious):
////////////////////////
#include <fstream>
bool stream_in( void )
{
std::ifstream is( "foo.txt" );
int i;
is >> i;
return true;
}
bool stream_out( void )
{
std::ofstream os( "foo.txt" );
os << 42 << '\n';
return true;
}
int main()
{
stream_out();
stream_in();
}
///////////////////////////
Today, it segfaults in stream_in at "is >> i;" and this is the backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0804f71d in std::ctype<char>::is(unsigned short, char) const (this=0x8053e68,
__m=8192, __c=0 '\0') at
/usr/local/gcc-exp/include/g++-v3/i686-pc-linux-gnu/bits/ctype_inline.h:40
(gdb) backtrace
#0 0x0804f71d in std::ctype<char>::is(unsigned short, char) const
(this=0x8053e68, __m=8192, __c=0 '\0') at
/usr/local/gcc-exp/include/g++-v3/i686-pc-linux-gnu/bits/ctype_inline.h:40
#1 0x0804d5f6 in sentry (this=0xbffff6ff, __in=@0xbffff730, __noskipws=false)
at /usr/local/gcc-exp/include/g++-v3/bits/istream.tcc:52
#2 0x0804cc05 in std::istream::operator>>(int&) (this=0xbffff730,
__n=@0xbffff72c) at /usr/local/gcc-exp/include/g++-v3/bits/istream.tcc:195
#3 0x0804c7c4 in stream_in() () at reduced.cc:9
#4 0x0804c8d0 in main () at reduced.cc:26
#5 0x4010e7fd in __libc_start_main (main=0x804c8b6 <main>, argc=1,
ubp_av=0xbffff8b4, init=0x804c3b8 <_init>, fini=0x8051280 <_fini>,
rtld_fini=0x4000ba34 <_dl_fini>, stack_end=0xbffff8ac) at
../sysdeps/generic/libc-start.c:129
Benjamin, honestly, I'm strongly suspecting your
http://gcc.gnu.org/ml/gcc-patches/2002-01/msg01221.html.
What do you think?
Cheers,
Paolo.