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

Bud Davis <bdavis at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bdavis at gcc dot gnu.org

--- Comment #3 from Bud Davis <bdavis at gcc dot gnu.org> 2012-02-03 22:08:10 
UTC ---
Index: gcc/libgfortran/io/unit.c
===================================================================
--- gcc/libgfortran/io/unit.c   (revision 183873)
+++ gcc/libgfortran/io/unit.c   (working copy)
@@ -637,6 +637,7 @@
   if (u->previous_nonadvancing_write)
     finish_last_advance_record (u);

+  __gthread_mutex_lock (&u->lock);
   rc = (u->s == NULL) ? 0 : sclose (u->s) == -1;

   u->closed = 1;


As theorized, the above patch does seem to correct the problem with no
regressions in the testsuite.

Reply via email to