diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-05-23 19:01:43 +0200 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-05-23 19:01:43 +0200 |
commit | 8df7ee67f6fdc780e9453f2baa8d1bf62c000761 (patch) | |
tree | 015a612d02b3a3e1cfc3b9ee97c08d8643d8e5a8 /libgfortran/io | |
parent | 584d52b088f9fcf78704b504c3f1f07e17c1cded (diff) | |
download | gcc-8df7ee67f6fdc780e9453f2baa8d1bf62c000761.zip gcc-8df7ee67f6fdc780e9453f2baa8d1bf62c000761.tar.gz gcc-8df7ee67f6fdc780e9453f2baa8d1bf62c000761.tar.bz2 |
Fixes a hang on an invalid ID in a WAIT statement.
gcc/fortran/ChangeLog:
2020-05-23 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/95191
* libgfortran.h (libgfortran_error_codes): Add
LIBERROR_BAD_WAIT_ID.
libgfortran/ChangeLog:
2020-05-23 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/95191
* io/async.c (async_wait_id): Generate error if ID is higher
than the highest current ID.
* runtime/error.c (translate_error): Handle LIBERROR_BAD_WAIT_ID.
libgomp/ChangeLog:
2020-05-23 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/95191
* testsuite/libgomp.fortran/async_io_9.f90: New test.
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/async.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libgfortran/io/async.c b/libgfortran/io/async.c index 63b9158..1bf38e9 100644 --- a/libgfortran/io/async.c +++ b/libgfortran/io/async.c @@ -424,6 +424,13 @@ async_wait_id (st_parameter_common *cmp, async_unit *au, int i) } LOCK (&au->lock); + if (i > au->id.high) + { + generate_error_common (cmp, LIBERROR_BAD_WAIT_ID, NULL); + UNLOCK (&au->lock); + return true; + } + NOTE ("Waiting for id %d", i); if (au->id.waiting < i) au->id.waiting = i; |