Hi Arsen!
On 2026-05-05T15:15:00+0200, Arsen Arsenović <[email protected]> wrote:
> 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.
Thanks! That's OK to push already in front of your other changes.
> --- 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);
Not sure this comments adds more insight than already is provided by the
surrounding code -- but I'm not objecting: I rather have one comment too
much than one too little. ;-)
> n->dynamic_refcount++;
>
> d = (void *) tgt->tgt_start;
I did wonder if, despite the 'assert', we'd make this:
d = (void *) tgt->tgt_start + n->tgt_offset;
..., to make clear the way this ought to be handled, but I guess there's
no reason to do that now, and it'll be obvious if we ever need to again
get rid of the 'assert' you're now introducing.
Grüße
Thomas