[Bug libstdc++/22309] mt allocator doesn't pthread_key_delete it's keys

jakub at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 14 13:01:00 GMT 2005


------- Additional Comments From jakub at redhat dot com  2005-07-14 12:48 -------
That patch fixes the original testcase, but unfortunately does not fix
the following one.
cat > P.c <<EOF
#include <dlfcn.h>
#include <pthread.h>

void *
tf (void *arg)
{
  void *h = dlopen ("./libP.so", RTLD_LAZY);
  void (*fn) (void);
  if (!h) return 0;
  fn = dlsym (h, "foo");
  fn ();
  void *h2 = dlopen ("libstdc++.so.6", RTLD_LAZY);
  if (!h2) return 0;
  dlclose (h);
  return 0;
}

int
main (void)
{
  pthread_t th;
  pthread_create (&th, NULL, tf, NULL);
  pthread_join (th, NULL);
  return 0;
}
EOF
cat > libP.C <<EOF
#include <string>
#include <ext/mt_allocator.h>

template class __gnu_cxx::__mt_alloc<short,
__gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >;
typedef std::char_traits<char> my_traits_type;
typedef __gnu_cxx::__mt_alloc<short,
__gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > my_allocator_type;
typedef std::basic_string<char, my_traits_type, my_allocator_type> my_string;

extern "C" void
foo (void)
{
  my_string s;
  s += "hello";
}
EOF
g++ -g -O2 -shared -fpic -o libP.so libP.C
gcc -g -O2 -o P P.c -ldl -lpthread


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22309



More information about the Gcc-bugs mailing list