A bug I accidentally introduced made it so that new variables are
allocated with some room to spare before them, and ergo, that tgt_offset
!= 0, leading to tests failing in what looked like a strange way.  Turns
out, goacc_enter_datum was failing to validate its assumption that
tgt_offset == 0.  This patch adds that assert.

libgomp/ChangeLog:

        * oacc-mem.c (goacc_enter_datum): Assert that tgt_offset of the
        newly-mapped variable is zero.
---
 libgomp/oacc-mem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 5601daf13957..f9ceb094d156 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -593,6 +593,9 @@ goacc_enter_datum (void **hostaddrs, size_t *sizes, void 
*kinds, int async)
       assert (n);
       assert (n->refcount == 1);
       assert (n->dynamic_refcount == 0);
+      assert (/* This is only reached if we're mapping a new, singular
+                variable, and so, its offset ought to be zero.  */
+             n->tgt_offset == 0);
       n->dynamic_refcount++;
 
       d = (void *) tgt->tgt_start;
-- 
2.54.0

Reply via email to