This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/66756] libgfortran: ThreadSanitizer: lock-order-inversion


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66756

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I think the current behavior is correct, only that the thread
sanitizer does not realize it.

From the comment in unit.c:

   Therefore to avoid deadlocks, it is forbidden
   to acquire unit's private locks while holding UNIT_LOCK, except
   for freshly created units (where no other thread can get at their
   address yet) or when using just trylock rather than lock operation.

... and this appears to be exactly what is happening there.

This makes debugging thread-related problems in libgfortran
somewhat harder, so I'm not sure what is the best course.

Should we try to "fix" this? It should be possible to do
file opening under UNIT_LOCK, that should not be a serious
performance bottleneck. OTOH, the current code seems OK, so
it could be a case of "If it ain't broke, don't fix it".

Opinions?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]