This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/88411] New: [9 Regression] Random crashes for ASYNCHRONOUS writes (bad locking?)
- From: "anlauf at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 07 Dec 2018 19:18:46 +0000
- Subject: [Bug libfortran/88411] New: [9 Regression] Random crashes for ASYNCHRONOUS writes (bad locking?)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88411
Bug ID: 88411
Summary: [9 Regression] Random crashes for ASYNCHRONOUS writes
(bad locking?)
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gmx dot de
Target Milestone: ---
Created attachment 45187
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45187&action=edit
Compile with -fopenmp, run with OMP_NUM_THREAD=2 or higher.
The attached code crashes randomly with 9.0 trunk gfortran when compiled
with -fopenmp and running with 2 or more threads:
At line 22 of file gfcbug153.f90 (unit = 10, file = 'file2.dat')
Fortran runtime error: Write exceeds length of DIRECT access record
Error termination. Backtrace:
#0 0x7fc02792019d in write_buf
at ../../../trunk/libgfortran/io/transfer.c:906
#1 0x7fc027920200 in unformatted_write
at ../../../trunk/libgfortran/io/transfer.c:1198
#2 0x40117f in gfcbug153
at /work/dwd/git/dace_code/gfcbug153.f90:22
#3 0x401302 in main
at /work/dwd/git/dace_code/gfcbug153.f90:25
Running the code under valgrind prints lots of
==30672== Thread #1: lock order "0x52BF360 before 0x647FBF0" violated
==30672==
==30672== Observed (incorrect) order is: acquisition of lock at 0x647FBF0
==30672== at 0x4C3291C: ??? (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x506F7D1: __gthread_mutex_trylock (gthr-default.h:757)
==30672== by 0x506F7D1: get_gfc_unit (unit.c:380)
==30672== by 0x505C462: _gfortran_st_close (close.c:64)
==30672== by 0x4012CB: MAIN__ (gfcbug153.f90:24)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672==
==30672== followed by a later acquisition of lock at 0x52BF360
==30672== at 0x4C3273C: ??? (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x507043B: __gthread_mutex_lock (gthr-default.h:748)
==30672== by 0x507043B: close_unit_1 (unit.c:735)
==30672== by 0x4012CB: MAIN__ (gfcbug153.f90:24)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672==
==30672== Required order was established by acquisition of lock at 0x52BF360
==30672== at 0x4C3273C: ??? (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x506F73C: __gthread_mutex_lock (gthr-default.h:748)
==30672== by 0x506F73C: get_gfc_unit (unit.c:332)
==30672== by 0x50678E8: _gfortran_st_open (open.c:880)
==30672== by 0x400F82: MAIN__ (gfcbug153.f90:20)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672==
==30672== followed by a later acquisition of lock at 0x647FBF0
==30672== at 0x4C3273C: ??? (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x506F6A9: __gthread_mutex_lock (gthr-default.h:748)
==30672== by 0x506F6A9: insert_unit (unit.c:244)
==30672== by 0x506F8C7: get_gfc_unit (unit.c:356)
==30672== by 0x50678E8: _gfortran_st_open (open.c:880)
==30672== by 0x400F82: MAIN__ (gfcbug153.f90:20)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672==
==30672== Lock at 0x52BF360 was first observed
==30672== at 0x4C3273C: ??? (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x506F73C: __gthread_mutex_lock (gthr-default.h:748)
==30672== by 0x506F73C: get_gfc_unit (unit.c:332)
==30672== by 0x50678E8: _gfortran_st_open (open.c:880)
==30672== by 0x400A96: MAIN__ (gfcbug153.f90:11)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672== Address 0x52bf360 is 0 bytes inside data symbol
"_gfortrani_unit_lock"
==30672==
==30672== Lock at 0x647FBF0 was first observed
==30672== at 0x4C3273C: ??? (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x506F6A9: __gthread_mutex_lock (gthr-default.h:748)
==30672== by 0x506F6A9: insert_unit (unit.c:244)
==30672== by 0x506F8C7: get_gfc_unit (unit.c:356)
==30672== by 0x50678E8: _gfortran_st_open (open.c:880)
==30672== by 0x400F82: MAIN__ (gfcbug153.f90:20)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672== Address 0x647fbf0 is 224 bytes inside a block of size 752 alloc'd
==30672== at 0x4C31645: calloc (in
/usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==30672== by 0x4E61C42: _gfortrani_xcalloc (memory.c:83)
==30672== by 0x506F667: insert_unit (unit.c:233)
==30672== by 0x506F8C7: get_gfc_unit (unit.c:356)
==30672== by 0x50678E8: _gfortran_st_open (open.c:880)
==30672== by 0x400F82: MAIN__ (gfcbug153.f90:20)
==30672== by 0x401302: main (gfcbug153.f90:25)
==30672== Block was alloc'd by thread #1
etc.