https://gcc.gnu.org/g:059f19c7957fd5c0e72b5202f2347419ad6d2a72

commit r17-1070-g059f19c7957fd5c0e72b5202f2347419ad6d2a72
Author: Arsen Arsenović <[email protected]>
Date:   Fri Apr 24 12:58:49 2026 +0000

    libgomp/oacc-mem: add missing assert to goacc_enter_datum
    
    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.

Diff:
---
 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;

Reply via email to