Hide Forgot
Description of problem: Valgrind reports error in c++ stream library if run against any c++ program that uses iostream Version-Release number of selected component (if applicable): 3.5.0-20.fc14 How reproducible: Every time Steps to Reproduce: create main.cpp: #include <iostream> using namespace std; int main() { cout << "Hello, world!\n"; return 0; } compile like this: g++ main.cpp -o main valgrind like this: valgrind ./main Actual results: ==7519== Memcheck, a memory error detector ==7519== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==7519== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==7519== Command: ./main ==7519== ==7519== Conditional jump or move depends on uninitialised value(s) ==7519== at 0x4005339: operator delete[](void*, std::nothrow_t const&) (vg_replace_malloc.c:380) ==7519== by 0x4ECCE7: ??? (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45C7C8: std::underflow_error::underflow_error(std::string const&) (stdexcept.cc:72) ==7519== by 0x45CFAD: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D01C: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D0A8: std::locale::locale() (strstream.cc:369) ==7519== by 0x459F97: std::ios_base::Init::Init() (locale_facets.h:1930) ==7519== by 0x80485B8: __static_initialization_and_destruction_0(int, int) (in /tmp/main) ==7519== by 0x80485F1: global constructors keyed to main (in /tmp/main) ==7519== by 0x804868C: ??? (in /tmp/main) ==7519== by 0x804843F: ??? (in /tmp/main) ==7519== by 0x8048618: __libc_csu_init (in /tmp/main) ==7519== ==7519== Invalid free() / delete / delete[] ==7519== at 0x4005379: operator delete[](void*, std::nothrow_t const&) (vg_replace_malloc.c:380) ==7519== by 0x4ECCE7: ??? (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45C7C8: std::underflow_error::underflow_error(std::string const&) (stdexcept.cc:72) ==7519== by 0x45CFAD: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D01C: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D0A8: std::locale::locale() (strstream.cc:369) ==7519== by 0x459F97: std::ios_base::Init::Init() (locale_facets.h:1930) ==7519== by 0x80485B8: __static_initialization_and_destruction_0(int, int) (in /tmp/main) ==7519== by 0x80485F1: global constructors keyed to main (in /tmp/main) ==7519== by 0x804868C: ??? (in /tmp/main) ==7519== by 0x804843F: ??? (in /tmp/main) ==7519== by 0x8048618: __libc_csu_init (in /tmp/main) ==7519== Address 0x418b24 is not stack'd, malloc'd or (recently) free'd ==7519== ==7519== Use of uninitialised value of size 4 ==7519== at 0x4005388: operator delete[](void*, std::nothrow_t const&) (vg_replace_malloc.c:380) ==7519== by 0x45C7C8: std::underflow_error::underflow_error(std::string const&) (stdexcept.cc:72) ==7519== by 0x45CFAD: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D01C: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D0A8: std::locale::locale() (strstream.cc:369) ==7519== by 0x459F97: std::ios_base::Init::Init() (locale_facets.h:1930) ==7519== by 0x80485B8: __static_initialization_and_destruction_0(int, int) (in /tmp/main) ==7519== by 0x80485F1: global constructors keyed to main (in /tmp/main) ==7519== by 0x804868C: ??? (in /tmp/main) ==7519== by 0x804843F: ??? (in /tmp/main) ==7519== by 0x8048618: __libc_csu_init (in /tmp/main) ==7519== by 0x662DD3: (below main) (libc-start.c:185) ==7519== ==7519== Invalid read of size 1 ==7519== at 0x4ECCE8: ??? (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45C7C8: std::underflow_error::underflow_error(std::string const&) (stdexcept.cc:72) ==7519== by 0x45CFAD: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D01C: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D0A8: std::locale::locale() (strstream.cc:369) ==7519== by 0x459F97: std::ios_base::Init::Init() (locale_facets.h:1930) ==7519== by 0x80485B8: __static_initialization_and_destruction_0(int, int) (in /tmp/main) ==7519== by 0x80485F1: global constructors keyed to main (in /tmp/main) ==7519== by 0x804868C: ??? (in /tmp/main) ==7519== by 0x804843F: ??? (in /tmp/main) ==7519== by 0x8048618: __libc_csu_init (in /tmp/main) ==7519== by 0x662DD3: (below main) (libc-start.c:185) ==7519== Address 0x6a004b06 is not stack'd, malloc'd or (recently) free'd ==7519== ==7519== ==7519== Process terminating with default action of signal 11 (SIGSEGV) ==7519== Access not within mapped region at address 0x6A004B06 ==7519== at 0x4ECCE8: ??? (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45C7C8: std::underflow_error::underflow_error(std::string const&) (stdexcept.cc:72) ==7519== by 0x45CFAD: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D01C: virtual thunk to std::strstream::~strstream() (in /usr/lib/libstdc++.so.6.0.14) ==7519== by 0x45D0A8: std::locale::locale() (strstream.cc:369) ==7519== by 0x459F97: std::ios_base::Init::Init() (locale_facets.h:1930) ==7519== by 0x80485B8: __static_initialization_and_destruction_0(int, int) (in /tmp/main) ==7519== by 0x80485F1: global constructors keyed to main (in /tmp/main) ==7519== by 0x804868C: ??? (in /tmp/main) ==7519== by 0x804843F: ??? (in /tmp/main) ==7519== by 0x8048618: __libc_csu_init (in /tmp/main) ==7519== by 0x662DD3: (below main) (libc-start.c:185) ==7519== If you believe this happened as a result of a stack ==7519== overflow in your program's main thread (unlikely but ==7519== possible), you can try to increase the size of the ==7519== main thread stack using the --main-stacksize= flag. ==7519== The main thread stack size used in this run was 8388608. ==7519== ==7519== HEAP SUMMARY: ==7519== in use at exit: 0 bytes in 0 blocks ==7519== total heap usage: 0 allocs, 1 frees, 0 bytes allocated ==7519== ==7519== All heap blocks were freed -- no leaks are possible ==7519== ==7519== For counts of detected and suppressed errors, rerun with: -v ==7519== Use --track-origins=yes to see where uninitialised values come from ==7519== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 15 from 8) Segmentation fault (core dumped) Expected results: No errors. Additional info:
reinstalling libstdc++ has resolved this problem.