[{"id":3687687,"web_url":"http://patchwork.ozlabs.org/comment/3687687/","msgid":"<877bpfa6u7.fsf@euler.schwinge.ddns.net>","list_archive_url":null,"date":"2026-05-07T09:48:16","subject":"Re: [PATCH 4/4] libgomp/oacc-mem: add missing assert to\n goacc_enter_datum","submitter":{"id":87905,"url":"http://patchwork.ozlabs.org/api/people/87905/","name":"Thomas Schwinge","email":"tschwinge@baylibre.com"},"content":"Hi Arsen!\n\nOn 2026-05-05T15:15:00+0200, Arsen Arsenović <aarsenovic@baylibre.com> wrote:\n> A bug I accidentally introduced made it so that new variables are\n> allocated with some room to spare before them, and ergo, that tgt_offset\n> != 0, leading to tests failing in what looked like a strange way.  Turns\n> out, goacc_enter_datum was failing to validate its assumption that\n> tgt_offset == 0.  This patch adds that assert.\n\nThanks!  That's OK to push already in front of your other changes.\n\n> --- a/libgomp/oacc-mem.c\n> +++ b/libgomp/oacc-mem.c\n> @@ -593,6 +593,9 @@ goacc_enter_datum (void **hostaddrs, size_t *sizes, void *kinds, int async)\n>        assert (n);\n>        assert (n->refcount == 1);\n>        assert (n->dynamic_refcount == 0);\n> +      assert (/* This is only reached if we're mapping a new, singular\n> +\t\t variable, and so, its offset ought to be zero.  */\n> +\t      n->tgt_offset == 0);\n\nNot sure this comments adds more insight than already is provided by the\nsurrounding code -- but I'm not objecting: I rather have one comment too\nmuch than one too little.  ;-)\n\n>        n->dynamic_refcount++;\n>  \n>        d = (void *) tgt->tgt_start;\n\nI did wonder if, despite the 'assert', we'd make this:\n\n    d = (void *) tgt->tgt_start + n->tgt_offset;\n\n..., to make clear the way this ought to be handled, but I guess there's\nno reason to do that now, and it'll be obvious if we ever need to again\nget rid of the 'assert' you're now introducing.\n\n\nGrüße\n Thomas","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=f5n6zMtc;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=f5n6zMtc","sourceware.org;\n dmarc=none (p=none dis=none) header.from=baylibre.com","sourceware.org; spf=pass smtp.mailfrom=baylibre.com","sourceware.org;\n arc=none smtp.remote-ip=2a00:1450:4864:20::333"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gB6s73lwlz1yCg\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 07 May 2026 19:48:58 +1000 (AEST)","from vm01.sourceware.org (localhost [IPv6:::1])\n\tby sourceware.org (Postfix) with ESMTP id 099934BA2E1F\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  7 May 2026 09:48:56 +0000 (GMT)","from mail-wm1-x333.google.com (mail-wm1-x333.google.com\n [IPv6:2a00:1450:4864:20::333])\n by sourceware.org (Postfix) with ESMTPS id E2CCA4BA2E0C\n for <gcc-patches@gcc.gnu.org>; Thu,  7 May 2026 09:48:21 +0000 (GMT)","by mail-wm1-x333.google.com with SMTP id\n 5b1f17b1804b1-488b3f8fa2bso17793255e9.1\n for <gcc-patches@gcc.gnu.org>; Thu, 07 May 2026 02:48:21 -0700 (PDT)","from euler.schwinge.ddns.net\n (p200300c8b74c7400ddfa326449be18ea.dip0.t-ipconnect.de.\n [2003:c8:b74c:7400:ddfa:3264:49be:18ea])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48e538acf23sm110093095e9.8.2026.05.07.02.48.20\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 07 May 2026 02:48:20 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 099934BA2E1F","OpenDKIM Filter v2.11.0 sourceware.org E2CCA4BA2E0C"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org E2CCA4BA2E0C","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org E2CCA4BA2E0C","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778147302; cv=none;\n b=ph94zBHQs0Qdny0GNW0QMXP0dZVmMZ1naiZ3gv4+lwUOHAjAs1krAPMkZI96lUg2QHaB5pLP4gqOFrA1b7ipcsJG3laczTuK5iSdSwRR1HPULgotRt0Sma9PtcV0UW74gsR41JwUNYjwJ0rVxV2Q5uOAi7oJIusIlUO/Hw2HPkY=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1778147302; c=relaxed/simple;\n bh=shfs/aZUQ3Vm/ARtGxxLHotmjlIsjlg3Af5wAB+oXzo=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=sVvZy96QlsjpJUPSF6Xby+JxhfHb4AR9CsnIJtkv9soU6cmFC3glykMie6wSqJDfldNSLjPorUlBBjeO6GkzHclk2baDXq4RSsagFlECZxGya/8/lVMQR8MmPE4hhvQBDeH06z82fhwvqfvVIt3CqLpYGMU+cSnG8fURj681tO8=","ARC-Authentication-Results":"i=1; sourceware.org;\n dkim=pass (2048-bit key, unprotected)\n header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=f5n6zMtc","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1778147301;\n x=1778752101;\n darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:user-agent\n :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=ZoSxycw9SeGsSZnyVXL4+6T8N92SxpSWG/NIMRER96g=;\n b=f5n6zMtcpP2++sPLWyk0abWzFyhxKvg6zbE06ls7WQQdYNTRT+tsK8pJ1xntatZDw9\n GbmxfZs6zcUKOc8OTZa6yXmg8Y0cyuzZiVxDrbttgcHgDeLHPDeT8o4dZvNZlIHIsn1y\n o6Ju3/l84w5lm6c902QgT+3wL7nOWeV+4SvTQbildUPMsXfujMcvUDWyqKDGJGc0T7Qa\n YZ76Y7QXohfUEX/2eFdDg6jWhUDpIEPQWwlxC0oWprCJLxywlVFddySWLUlfxjL9yC24\n fZ8KbPsq/7gPl7af3enuFSofbUJRgs2R031+dUEQUzy4sLtYPOEWMWumH6cm1D6lYwjs\n Mlug==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1778147301; x=1778752101;\n h=content-transfer-encoding:mime-version:message-id:date:user-agent\n :references:in-reply-to:subject:cc:to:from:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=ZoSxycw9SeGsSZnyVXL4+6T8N92SxpSWG/NIMRER96g=;\n b=Z/7rr27YfoV/StPxNObZIaRxe5fuTcKy2ynJwz74BNDmmcGVXzgiHelFf9uBSd4cW/\n UXZJx1b5VJAplrEgIabqUsq97KIh4fdyzkvZe6GDppA+3ak83GP8eV7OiX3Rpf9WO2xW\n ZnSpPxv63OfXdnI/BpBALMoqEpFMJL9bWR7B8/QDv+NodO0IRMD6B88V5213cuVUfnUt\n 9nCVnDi/gAUUIxZvFHeunRuxv/akm4EmHz2xctrcaRLZEZMlIrLf+2GR6LIxoUEg7Z9H\n xkuPqeM0OGs94JIcRE8+vG21bUqG9uCkrUFDR71gMRCt6OOeVFuzjJ84a23v3uNVcMhH\n Peag==","X-Gm-Message-State":"AOJu0YytozAbkyMsQ/xfQBEWGpuGl5eTnuHEx+i2FmjnlVY8/uG8Fp6j\n sFc9cvj6HrSBBei378Txb+HEYcJUwVRfcYCnvz2AmsC7nwtyMOHsCIDODIbNFWasutQ=","X-Gm-Gg":"AeBDietmbbiK6bPKvF129o2nlASrPBjRmcXDt6X4kKEqz05+dCWLuJRPLhNWrnXxRVg\n uCuF0eD9dY4M/jnggUqLiilr8qJydl3Mz7RoNmozLDY/vkkK6gAqEKmuYrF7FRJ/QsZ7JR6x3AD\n IW7yNfrx085NUz4Ku4wYQnzeKThuIYNJ52JjY83eVBxeKqbAkHTGxTlAN3UVGZ/0ygNXSu9V6zT\n m83gerHfaTwhZXILaMHUnJPZOBFSVakDpMpKoDhsWumuA5MsB7a8lDVNhZ2Ldk9k8vThvloYerk\n PHFgpXdXVSeCv2z4joujOCF9Jio489LDjpzo58RUCAJmTcPFDS2piYinV04q39u8QoCMVdktyBa\n nA+LzWyldyIOUQ/uXQX/sLFVezZNSyEE9OU8UW8nG+uTiMpOzuKjYTT+WSy2pLLsB81qHDcZOq4\n XaWimow037t+iPccMPl35XreAAQWNRFJ43I5HcJZy1kemnYU1BhDS59cVAkZfVatNtJ/AWFbrHc\n tn1UbUDvgo4Ac+GgcKYt8WTMXMqmD5Ql+E9XOnku4Nh2LUcvGcbg5v0gPacZGgFCtg=","X-Received":"by 2002:a05:600c:3b20:b0:489:1d7a:4537 with SMTP id\n 5b1f17b1804b1-48e5dfcd4a9mr29902525e9.3.1778147300532;\n Thu, 07 May 2026 02:48:20 -0700 (PDT)","From":"Thomas Schwinge <tschwinge@baylibre.com>","To":"Arsen =?utf-8?q?Arsenovi=C4=87?= <aarsenovic@baylibre.com>","Cc":"gcc-patches@gcc.gnu.org","Subject":"Re: [PATCH 4/4] libgomp/oacc-mem: add missing assert to\n goacc_enter_datum","In-Reply-To":"<20260505134929.3522938-5-aarsenovic@baylibre.com>","References":"<20260505134929.3522938-1-aarsenovic@baylibre.com>\n <20260505134929.3522938-5-aarsenovic@baylibre.com>","User-Agent":"Notmuch/0.40~rc1 (https://notmuchmail.org) Emacs/30.2\n (x86_64-pc-linux-gnu)","Date":"Thu, 07 May 2026 11:48:16 +0200","Message-ID":"<877bpfa6u7.fsf@euler.schwinge.ddns.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]