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 | |
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')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/async.c | 7 | ||||
-rw-r--r-- | libgfortran/runtime/error.c | 4 |
3 files changed, 18 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 71c233c..ddb1af1 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +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. + 2020-05-21 H.J. Lu <hongjiu.lu@intel.com> * m4/matmul.m4: Don't include <config/i386/cpuinfo.h>. Use 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; diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 9ed5d56..ff6b852 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -660,6 +660,10 @@ translate_error (int code) p = "Inquire statement identifies an internal file"; break; + case LIBERROR_BAD_WAIT_ID: + p = "Bad ID in WAIT statement"; + break; + default: p = "Unknown error code"; break; |