ddrescue segfaults in option parsing after gcc was updated from 4.3.4-4 to 4.5.3-2.
(ddrescue package was build with g++ 4.3.4-3)

I tracked down the problem to a segfault in vector< string > destructor, see attached testcase.


1. Compile and run with g++ 4.3.4, use -O2 to enable inline expansion:

$ g++ -O2 -o testvector testvector.cpp

$ cygcheck -f /bin/cygstdc++-6.dll
libstdc++6-4.3.4-4

$ ./testvector
vector created (12)
vector destroyed


2. Update libstdc++ and rerun:

$ cygcheck -f /bin/cygstdc++-6.dll
libstdc++6-4.5.3-2

$ ./testvector
vector created (12)
Aborted (core dumped)


Recompiling with new g++ fixes the problem.
Old inline code is probably no longer compatible with code in new cygstdc++-6.dll.

--
Regards,
Christian Franke

#include <cstdio>
#include <string>
#include <vector>

int main()
{
  {
    std::vector<std::string> v;
    v.resize(1);
    printf("vector created (%d)\n", (int)sizeof(v)); fflush(stdout);
  }
  printf("vector destroyed\n"); fflush(stdout);
  return 0;
}


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to