diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2019-12-18 18:01:33 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2019-12-18 18:01:33 +0100 |
commit | 83d1d065df01e4f21afd763c17f1d48e0a1161aa (patch) | |
tree | 1d51590070015c5596cf1b05bb8ef3c336c7cb1e /libgomp/target.c | |
parent | cc3f11f5f51ea1f192b23c8df793e23d7163002d (diff) | |
download | gcc-83d1d065df01e4f21afd763c17f1d48e0a1161aa.zip gcc-83d1d065df01e4f21afd763c17f1d48e0a1161aa.tar.gz gcc-83d1d065df01e4f21afd763c17f1d48e0a1161aa.tar.bz2 |
Assert in 'libgomp/target.c:gomp_unmap_vars_internal' that we're not unmapping 'tgt' while it's still in use
libgomp/
* target.c (gomp_unmap_vars_internal): Add a safeguard to
'gomp_remove_var'.
From-SVN: r279534
Diffstat (limited to 'libgomp/target.c')
-rw-r--r-- | libgomp/target.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libgomp/target.c b/libgomp/target.c index a3cdb34..67cd80a 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -1225,7 +1225,15 @@ gomp_unmap_vars_internal (struct target_mem_desc *tgt, bool do_copyfrom, + tgt->list[i].offset), tgt->list[i].length); if (do_unmap) - gomp_remove_var (devicep, k); + { + struct target_mem_desc *k_tgt = k->tgt; + bool is_tgt_unmapped = gomp_remove_var (devicep, k); + /* It would be bad if TGT got unmapped while we're still iterating + over its LIST_COUNT, and also expect to use it in the following + code. */ + assert (!is_tgt_unmapped + || k_tgt != tgt); + } } if (aq) |