Crash when outputting empty string
Richard Atterer
atterer@informatik.tu-muenchen.de
Thu Oct 14 09:30:00 GMT 1999
Hello,
I'm having trouble with outputting a zero-length string when using
libstdc++-2.90.6. The program below crashes when f() is called for the
second time. Everything works fine when I use the libstdc++ supplied with
gcc 2.95.1, though:
/* libstd.cc
> /home/richard/gcc-2.95.1/bin/c++ \
-I/home/richard/gcc-2.95.1/libstdc++-2.90.6/include/g++-v3 \
-L/home/richard/gcc-2.95.1/libstdc++-2.90.6/lib -v
Reading specs from
/home/richard/gcc-2.95.1/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)
> /home/richard/gcc-2.95.1/bin/c++ \
-I/home/richard/gcc-2.95.1/libstdc++-2.90.6/include/g++-v3 \
-L/home/richard/gcc-2.95.1/libstdc++-2.90.6/lib -Wall -O libstd.cc
*/
#include <iostream>
#include <string>
string s;
void f() {
cerr << s << 46 << endl;
return;
}
int main() {
f(); // works
f(); // crashes if (s == "")
return 0;
}
I see there's something like this in the 'known bugs' document, but maybe
this example will help you to track down the problem.
Another issue are the warnings which gcc outputs, e.g. whenever you
#include <iostream>. Is there any means by which you can avoid their being
output?
Cheers,
Richard
--
__ _
|_) /| Richard Atterer (currently at Queen's University, Belfast, NI)
| \/ï| http://www.in.tum.de/~atterer/
ï ô` ï
More information about the Libstdc++
mailing list