[patch, fortran, gcc] PR35063 [Regression wrt g77] I/O leaks handles/memory on Windows XP

Jerry DeLisle jvdelisle@verizon.net
Sat Feb 9 15:54:00 GMT 2008


Andrew Pinski wrote:
> On Feb 8, 2008 3:42 PM, Jerry DeLisle <jvdelisle@verizon.net> wrote:
>> Ok to commit?  I need a gcc maintainer to approve as well.
> 
> It might be best if you created a __gthread_mutex_destroy_function for
> each of the gthr-* files and not do it via
> __GTHREAD_MUTEX_DESTROY_FUNCTION .
> 
> The reason I am saying this is because targets which single threading
> will now fail because of the use of pthread_mutex_destroy.
> 

For the short term, I suggest the following to alleviate the immediate problem 
on windows.  I have tested this on i686-pc-cygwin. Then for 4.4 we can have the 
rest of the gthr-* files fixed.

My hesitation to go into the other files now is my lack of familiarity and i don 
not have access to test all the other platforms.  This fix limits the scope to 
Windows only.

OK for trunk with this change?

Jerry

Index: unit.c
===================================================================
--- unit.c      (revision 132079)
+++ unit.c      (working copy)
@@ -204,6 +204,22 @@ insert_unit (int n)
  }


+/* destroy_unit_mutex()-- Destroy the mutex and free memory of unit.  */
+
+static void
+destroy_unit_mutex (gfc_unit * u)
+{
+#ifdef __GTHREAD_MUTEX_DESTROY_FUNCTION
+  __GTHREAD_MUTEX_DESTROY_FUNCTION (&u->lock);
+#else
+#ifdef __CYGWIN__
+  pthread_mutex_destroy (&u->lock);
+#endif
+#endif
+  free_mem (u);
+}
+
+
  static gfc_unit *
  delete_root (gfc_unit * t)
  {



More information about the Fortran mailing list