eh-mt problems

scott snyder snyder@d0sgif.fnal.gov
Thu Dec 18 10:05:00 GMT 1997


>I'm trying to get egcs-1.0 running on my alpha linux. I got the eh
>thread safe
>patch from the mailing list and have modified a couple of configuration
>files 
>for alpha linux. Now I try the new compiler and have run into trouble
>with
>the process SEGV when a thread exit.

If you're using version 0.6 of linuxthreads, there's a bug in the
destructor feature of the thread specific data stuff, which can cause
the destructor to be called multiple times.  This causes the mt-eh
code to call free() multiple times on the same block of memory,
corrupting the heap.

It looks like this problem is fixed in the development version
of linuxthreads.  In the meantime, here's a patch to linuxthreads 0.6
which fixes this problem for me.  (I've only tested it on a i386
platform, though.)

sss

--- specific.c-orig     Thu Dec  4 16:45:30 1997
+++ specific.c  Thu Dec  4 16:47:05 1997
@@ -113,8 +113,9 @@
          data = self->p_specific[i];
          if (destr != NULL && data != NULL)
            {
+              self->p_specific[i] = NULL;
              destr (data);
-             found_nonzero |= self->p_specific[i] != NULL;
+             found_nonzero |= 1;
            }
        }
 



More information about the Gcc mailing list