This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/66756] libgfortran: ThreadSanitizer: lock-order-inversion
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Sep 2017 18:10:06 +0000
- Subject: [Bug libfortran/66756] libgfortran: ThreadSanitizer: lock-order-inversion
- Auto-submitted: auto-generated
- References: <bug-66756-4@http.gcc.gnu.org/bugzilla/>
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?