diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-12-09 18:54:47 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-12-09 18:54:47 +0000 |
commit | d0cbb206e2068e97efc3022c587bdaa16b85d9c0 (patch) | |
tree | 73a313fa1bb5731bfb41b304166e42efd23d89d8 /libgfortran/io/transfer.c | |
parent | 59cd1934df18511835b88e36edf0327db5db738b (diff) | |
download | gcc-d0cbb206e2068e97efc3022c587bdaa16b85d9c0.zip gcc-d0cbb206e2068e97efc3022c587bdaa16b85d9c0.tar.gz gcc-d0cbb206e2068e97efc3022c587bdaa16b85d9c0.tar.bz2 |
re PR libfortran/88411 (Random crashes for ASYNCHRONOUS writes (bad locking?))
2018-12-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/88411
* io/transfer.c (dta_transfer_init): Do not treat as an
asynchronous statement unless the statement has
ASYNCHRONOUS="YES".
(st_write_done): Likewise.
(st_read_done): Do not perform async_wait for synchronous I/O
on an async unit.
(st_read_done): Likewise.
2018-12-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/88411
* testsuite/libgomp.fortran/async_io_8.f90: New test.
From-SVN: r266929
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 4013b3b..6fcec8a 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -3189,7 +3189,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) } } - if (au) + if (au && dtp->u.p.async) { NOTE ("enqueue_data_transfer"); enqueue_data_transfer_init (au, dtp, read_flag); @@ -4313,11 +4313,8 @@ st_read_done (st_parameter_dt *dtp) *dtp->id = enqueue_done_id (dtp->u.p.current_unit->au, AIO_READ_DONE); else { - enqueue_done (dtp->u.p.current_unit->au, AIO_READ_DONE); - /* An asynchronous unit without ASYNCHRONOUS="YES" - make this - synchronous by performing a wait operation. */ - if (!dtp->u.p.async) - async_wait (&dtp->common, dtp->u.p.current_unit->au); + if (dtp->u.p.async) + enqueue_done (dtp->u.p.current_unit->au, AIO_READ_DONE); } } else @@ -4401,18 +4398,17 @@ st_write_done (st_parameter_dt *dtp) { if (dtp->u.p.current_unit) { - if (dtp->u.p.current_unit->au) + if (dtp->u.p.current_unit->au && dtp->u.p.async) { if (dtp->common.flags & IOPARM_DT_HAS_ID) *dtp->id = enqueue_done_id (dtp->u.p.current_unit->au, AIO_WRITE_DONE); else { - enqueue_done (dtp->u.p.current_unit->au, AIO_WRITE_DONE); - /* An asynchronous unit without ASYNCHRONOUS="YES" - make this - synchronous by performing a wait operation. */ - if (!dtp->u.p.async) - async_wait (&dtp->common, dtp->u.p.current_unit->au); + /* We perform synchronous I/O on an asynchronous unit, so no need + to enqueue AIO_READ_DONE. */ + if (dtp->u.p.async) + enqueue_done (dtp->u.p.current_unit->au, AIO_WRITE_DONE); } } else |