This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Suspicious C++ stringstream crashes, gcc 3.3.3
- From: Andrew Walrond <andrew at walrond dot org>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 24 May 2004 15:18:54 +0100
- Subject: Suspicious C++ stringstream crashes, gcc 3.3.3
Are there any known stringstream problems in 3.3.3? I have a reproducible
crash which seems to scribble on the stack and causes a segfault. Bugzilla
searches haven't thrown up anything useful.
Usual story; If I put in debug code, it goes away, so I haven't been able to
isolate a small test case. But I am now pretty convinced that the problem
lies here.
This is the suspect code snippet, which simply creates a hex string from some
bytes.
---
ostringstream _HexDigest;
_HexDigest << hex << setfill('0') << internal;
for (int i=0; i<SHA_DIGEST_LENGTH; i++)
_HexDigest << setw(2) << (unsigned)mBytes[i];
---
In gdb it looks like this:
---
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2377)]
0x40298b1c in memcpy () from /pkg/glibc.1/lib/libc.so.6
(gdb) bt
#0 0x40298b1c in memcpy () from /pkg/glibc.1/lib/libc.so.6
#1 0x400728d4 in std::__pad<char, std::char_traits<char>
>::_S_pad(std::ios_base&, char, char*, char const*, int, int, bool) ()
from /lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5
#2 0x40072a84 in std::num_put<char, std::ostreambuf_iterator<char,
std::char_traits<char> > >::_M_pad(char, int, std::ios_base&, char*, char
const*, int&) const ()
from /lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5
#3 0x40073b50 in std::ostreambuf_iterator<char, std::char_traits<char> >
std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> >
>::_M_convert_int<unsigned long>(std::ostreambuf_iterator<char,
std::char_traits<char> >, std::ios_base&, char, unsigned long) const ()
from /lib/gcc-lib/i686-pc-linux-gnu/3.3.3/libstdc++.so.5
#4 0xa3a10000 in ?? ()
(gdb) info args
No symbol table info available.
(gdb)
---
Please let me know if this rings any bells
Andrew Walrond