https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113005
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=55561
--- Comment #18 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
I get warnings like below after building both libgomp and the test program with
tsan (following PR55561 comment 15):
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
(pid=867077)
Cycle in lock order graph: M0 (0x7ffff0061550) => M1 (0x7fffebb270e0) => M0
Mutex M1 acquired here while holding mutex M0 in thread T13:
#0 pthread_mutex_lock
../../../../gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1371
(libtsan.so.2+0x5b668)
#1 __gthread_mutex_lock ../libgcc/gthr-default.h:795
(libgfortran.so.5+0x17376c)
#2 insert_unit ../../../gcc/libgfortran/io/unit.c:250
(libgfortran.so.5+0x17376c)
#3 gomp_thread_start ../../../gcc/libgomp/team.c:129 (libgomp.so.1+0x325f8)
Mutex M0 previously acquired by the same thread here:
#0 pthread_rwlock_wrlock
../../../../gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1552
(libtsan.so.2+0x5a204)
#1 __gthread_rwlock_wrlock ../libgcc/gthr-default.h:957
(libgfortran.so.5+0x17386c)
#2 get_gfc_unit ../../../gcc/libgfortran/io/unit.c:379
(libgfortran.so.5+0x17386c)
#3 gomp_thread_start ../../../gcc/libgomp/team.c:129 (libgomp.so.1+0x325f8)
Mutex M0 acquired here while holding mutex M1 in thread T13:
#0 pthread_rwlock_wrlock
../../../../gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1552
(libtsan.so.2+0x5a204)
#1 __gthread_rwlock_wrlock ../libgcc/gthr-default.h:957
(libgfortran.so.5+0x174564)
#2 close_unit_1 ../../../gcc/libgfortran/io/unit.c:770
(libgfortran.so.5+0x174564)
#3 gomp_thread_start ../../../gcc/libgomp/team.c:129 (libgomp.so.1+0x325f8)
Mutex M1 previously acquired by the same thread here:
#0 pthread_mutex_trylock
../../../../gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1384
(libtsan.so.2+0x59a64)
#1 __gthread_mutex_trylock ../libgcc/gthr-default.h:804
(libgfortran.so.5+0x1739c4)
#2 get_gfc_unit ../../../gcc/libgfortran/io/unit.c:415
(libgfortran.so.5+0x1739c4)
#3 gomp_thread_start ../../../gcc/libgomp/team.c:129 (libgomp.so.1+0x325f8)
Thread T13 (tid=867091, running) created by main thread at:
#0 pthread_create
../../../../gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1041
(libtsan.so.2+0x5c10c)
#1 gomp_team_start ../../../gcc/libgomp/team.c:859 (libgomp.so.1+0x32f30)
#2 GOMP_parallel ../../../gcc/libgomp/parallel.c:176 (libgomp.so.1+0x20e0c)
#3 MAIN__
/home/xry111/git-repos/gcc/libgomp/testsuite/libgomp.fortran/rwlock_1.f90:6
(a.out+0x1394)
#4 main
/home/xry111/git-repos/gcc/libgomp/testsuite/libgomp.fortran/rwlock_1.f90:7
(a.out+0x1414)
SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock)
../libgcc/gthr-default.h:795 in __gthread_mutex_lock
I'm not sure if the warning is correct or not.