[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#191684: libstdc++5 3.3 breaks optimized binaries compiled with g++ 3.2



Package: libstdc++5
Version: 1:3.3-0pre7
Severity: important



After upgrading libstdc++5 from the 3.2 version to the 3.3 version, my
c++ binaries started to segfault. I traced the problem to this test
case:



#include <string>
#include <sstream>



using namespace std;



// Returns the argument as a string.
template <class T>
string to_string (T arg) {
    ostringstream buffer;
    buffer << arg;
    return buffer.str();
}



int main () {
    int num = 42;
    printf("%s\n", to_string(num).c_str());
    return 0;
}



Compile this with g++-3.2 -O3 -finline-limit=1000 and running it will
segfault. The same binary will work using the 3.2
libstdc++5. Compiling without optimization also works, as does
compiling with g++-3.3. However I believe it is important to maintain
binary compatibility in libstdc++5 with all the c++ code compiled with
g++ 3.2.



Here is a backtrace of the crash:

#0 0x4008b4a1 in bool std::has_facet<std::messages<wchar_t> >(std::locale const&) () from /usr/lib/libstdc++.so.5 #1 0x4007e424 in std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_convert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const () from /usr/lib/libstdc++.so.5 #2 0x4007e178 in std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const () from /usr/lib/libstdc++.so.5 #3 0x4009052f in std::ostream::operator<<(long) () from /usr/lib/libstdc++.so.5
#4  0x08048d4b in main ()
#5  0x40110a51 in __libc_start_main () from /lib/libc.so.6




-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux guinness 2.4.20-hpcs #1 SMP Mon Jan 27 10:13:02 PST 2003 i686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8

Versions of packages libstdc++5 depends on:
ii gcc-3.3-base 1:3.3-0pre7 The GNU Compiler Collection (base ii libc6 2.3.1-17 GNU C Library: Shared libraries an
ii  libgcc1                      1:3.3-0pre7 GCC support library

-- no debconf information

--
Michael Babcock
Jim Henson's Creature Shop





Reply to: