Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2233037/?format=api
{ "id": 2233037, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233037/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260505151030.1749548-8-waffl3x@baylibre.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260505151030.1749548-8-waffl3x@baylibre.com>", "list_archive_url": null, "date": "2026-05-05T15:02:00", "name": "[07/12] OpenMP/C++: Don't do NRVO on vars used in an 'omp allocate' directive", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c8fad88f1f88004b6c78118c7a3791ea3911a836", "submitter": { "id": 90070, "url": "http://patchwork.ozlabs.org/api/1.2/people/90070/?format=api", "name": "Waffl3x", "email": "waffl3x@baylibre.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260505151030.1749548-8-waffl3x@baylibre.com/mbox/", "series": [ { "id": 502853, "url": "http://patchwork.ozlabs.org/api/1.2/series/502853/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=502853", "date": "2026-05-05T15:01:54", "name": "OpenMP/C++: 'allocate' directive", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502853/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2233037/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2233037/checks/", "tags": {}, "related": [], "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=WlYQsdBA;\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=WlYQsdBA", "sourceware.org;\n dmarc=none (p=none dis=none) header.from=baylibre.com", "sourceware.org; spf=pass smtp.mailfrom=baylibre.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::42e" ], "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 4g925y5qj5z1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 01:11:18 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D180B4BA900E\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 5 May 2026 15:11:16 +0000 (GMT)", "from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com\n [IPv6:2607:f8b0:4864:20::42e])\n by sourceware.org (Postfix) with ESMTPS id 1C78A4BA900B\n for <gcc-patches@gcc.gnu.org>; Tue, 5 May 2026 15:10:44 +0000 (GMT)", "by mail-pf1-x42e.google.com with SMTP id\n d2e1a72fcca58-83538fcdda8so169598b3a.3\n for <gcc-patches@gcc.gnu.org>; Tue, 05 May 2026 08:10:44 -0700 (PDT)", "from waffl3x-prestige.lan ([2001:56a:f98a:b800:1f67:ce08:3cbd:86b8])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-83965645140sm2674956b3a.12.2026.05.05.08.10.42\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 05 May 2026 08:10:42 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org D180B4BA900E", "OpenDKIM Filter v2.11.0 sourceware.org 1C78A4BA900B" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 1C78A4BA900B", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 1C78A4BA900B", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777993844; cv=none;\n b=uKJ6aVz+nKcjV1Qm4ZzdIxG7N4bg13gT/U+YQWU6ehxKiCRVeuD0+GrwoFhoGjseo6/Wqq6lh6Dx10IUy+zuGUiFtq6WVGMOLO5xB6Wix7en4Up4SW00w9eVrbFqbFevbAUPuug0fpRC9+RcOn5m0PeomLNIasXawFfCOdCLONU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777993844; c=relaxed/simple;\n bh=G2vQlhkBOWaDEz2caMDohH+GhO+gQ1HuBT0tT4Y4bQs=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=wplP4DS4WC4roZPqCFfiXh1ov+KJgE15NuK5xTZk4uL922A2+RyHmvcqen7Bce4mjyWStmSU5ZKUjkX0MOmhuJIA51NQOYkVHYciJJBcj3z6iO9Z/tU11JxpN58phIPTSJH4t5Ae4Ryar3C0Rg+2pwq0kVKd4UGR48p3jIhB4tk=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1777993843;\n x=1778598643;\n darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=mkLCCZpAyNYsCOGTjnMZPSLXY0v56RXrnUCh8+ZoCNQ=;\n b=WlYQsdBAEjVQTS9X6hTCIpVjDXRpXlwdqRdZzwzSyA7K0KUqVbFa6WvUen6PUmfYTt\n qOG8yNZI5iAtuZHbhkmwzgNDybHSHC9qdLIWzJ/uniKQ11vln5aJTRfNleSCN+dB331A\n m44+aaZN+A3vK6eoFgAzZWzQ9gWHq6W/fPB25TrXfRXAwU2VF8ij3XgGrpKTyFMUd0io\n e4SKbjsWzIGlcSEFD/ETJUEyhuQpkH/fjEXd6PTVOs+YrhqAik1R4/Eg9A/M2Kjtg9xa\n kSGOVJcqFAEZJrRK3F5uwdA4u4xMBVXMHP7zIcBYxHuBkditi18Ro9h5DTEX2WEPEpDs\n ikzQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777993843; x=1778598643;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=mkLCCZpAyNYsCOGTjnMZPSLXY0v56RXrnUCh8+ZoCNQ=;\n b=KPwZF4Ockf6jprv3UHQqjZ8LzkOCafwf/rwwdPu3eyqizp7AE2ydfJfbhhiuMfE8ec\n uq7JZuBX4Wy1Gd5WTYBXnVPnviTkZeVqOxTdyl2gkbpJ76vrm7ZAXr+8+wlcLrHhE0xv\n aV3rdH3ptstzIlSb+NSgLctXH8oGzP8t5adPtTVbAhUgSor5yqvlD4YKrmH2QvyrDqMi\n TKeX+W4qlKvMDr+3pz8ujJXSQwutS7SKSHCQoRFPnH/MGvkc6FkLeGGoC6wJlduPtYXS\n ViyELItanVByl1p5/YQVYGswHyL+9OuEa7AzHKji1A0/O9WYQ2LpL0TadoPF4trqCAVI\n a2OQ==", "X-Gm-Message-State": "AOJu0YwdPOGeYfhPgiIx/L+Z5w51Y2aanGbEbeDtJQnatxO10kNf26lP\n JG1eyAurta0Qp1O25rg6EOIrVi8maJSa8FG/SwIFa2xDWlJUwkoGfSBiHDow4ECVnM8hRobNRUc\n sqDha", "X-Gm-Gg": "AeBDiesNLDFyZPm/g5wc4/Oyoo3HdcYuPJbCkEm0FTySgoF1acj0TQj4hWCO83u+BcZ\n JMo/rNltvJz+UtCeSwHzjQzT0jAKt2B749srQb61fFEBRbC+TkIFhrIqGjGy9gu0Ve+RxfKasIv\n c3/vo3MvkZBYLriuerntTB34qng4wtxODZjH9DyqZvoOIwwE9XPNe7zW5TzxmS66IQTbmyLPT1I\n 1XRcWwqSOKeBw9nB1GQqy1efP0ARDmg5XVkBTKIQKScvfTzmMjspBU78GwKSGZ6HqLVtJR2Dlys\n eBrk6X22OWtIdTGCI3bVw9HEVcisUEO9uvE3Y5jV/3+d8RikwSCOgVu0xKZFdfavRFtW7M5IFJT\n 9kn91/2V3Vh5ZNcLMKe9+qDBk9G0QyaBte99zVh9BudEHU3vfW9fuoouYXPfnWbtBW2L2xGuUlx\n LsAm6EgKfn3X2paWc6nlU0ELmiSws+nD6JrScrR1n7Klx3UnMOOw==", "X-Received": "by 2002:aa7:88c8:0:b0:837:42a6:58a8 with SMTP id\n d2e1a72fcca58-83742b5accdmr4734237b3a.2.1777993843081;\n Tue, 05 May 2026 08:10:43 -0700 (PDT)", "From": "Waffl3x <waffl3x@baylibre.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Waffl3x <waffl3x@baylibre.com>", "Subject": "[PATCH 07/12] OpenMP/C++: Don't do NRVO on vars used in an 'omp\n allocate' directive", "Date": "Tue, 5 May 2026 09:02:00 -0600", "Message-ID": "<20260505151030.1749548-8-waffl3x@baylibre.com>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260505151030.1749548-1-waffl3x@baylibre.com>", "References": "\n <CAH+W3Ppbho4pj6W-rWk4mMssrttOjt7aNco-oWW5Sw5f5Yx2GA@mail.gmail.com>\n <20260505151030.1749548-1-waffl3x@baylibre.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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" }, "content": "NRVO is incompatible with the transformations made by an allocate\ndirective, this patch disables it for those variables.\n\nAlso adjusts a few tests that were modified to work around this bug.\n\ngcc/cp/ChangeLog:\n\n\t* typeck.cc (can_do_nrvo_p): Return false for vars in an allocate\n\tdirective.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/gomp/allocate-5.C: Remove workarounds, enable ilp32.\n\t* g++.dg/gomp/allocate-6.C: Likewise.\n\t* g++.dg/gomp/allocate-7.C: Likewise.\n\t* g++.dg/gomp/allocate-22.C: New test.\n\nSigned-off-by: Waffl3x <waffl3x@baylibre.com>\n---\n gcc/cp/typeck.cc | 5 +++-\n gcc/testsuite/g++.dg/gomp/allocate-22.C | 31 +++++++++++++++++++++++++\n gcc/testsuite/g++.dg/gomp/allocate-5.C | 3 +--\n gcc/testsuite/g++.dg/gomp/allocate-6.C | 3 +--\n gcc/testsuite/g++.dg/gomp/allocate-7.C | 8 ++++---\n 5 files changed, 42 insertions(+), 8 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/gomp/allocate-22.C", "diff": "diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc\nindex dcc35ae28a2..68a07229ece 100644\n--- a/gcc/cp/typeck.cc\n+++ b/gcc/cp/typeck.cc\n@@ -11164,7 +11164,10 @@ can_do_nrvo_p (tree retval, tree functype)\n \t && same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (retval)),\n \t\t\t TYPE_MAIN_VARIANT (functype))\n \t /* And the returned value must be non-volatile. */\n-\t && !TYPE_VOLATILE (TREE_TYPE (retval)));\n+\t && !TYPE_VOLATILE (TREE_TYPE (retval))\n+\t /* And the variable must not be used in an allocate directive. */\n+\t && (!flag_openmp || !lookup_attribute (\"omp allocate\",\n+\t\t\t\t\t\t DECL_ATTRIBUTES (retval))));\n }\n \n /* True if we would like to perform NRVO, i.e. can_do_nrvo_p is true and we\ndiff --git a/gcc/testsuite/g++.dg/gomp/allocate-22.C b/gcc/testsuite/g++.dg/gomp/allocate-22.C\nnew file mode 100644\nindex 00000000000..821d9b2c610\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/gomp/allocate-22.C\n@@ -0,0 +1,31 @@\n+/* { dg-do compile { target c++14 } } */\n+\n+/* This used to ICE due to NRVO being attempted on 's', NRVO can not be\n+ done on a variable used in an allocate directive. */\n+\n+/* NRVO probably kicks in when sizeof(T) is greater than 16. */\n+struct S\n+{\n+ char _v[17];\n+};\n+\n+S f0()\n+{\n+ S s;\n+ #pragma omp allocate(s)\n+ return s;\n+}\n+\n+/* Also test with a VERY LARGE type just in case the above isn't big enough\n+ to trigger NRVO in all cases. */\n+struct Big\n+{\n+ char _v[4096];\n+};\n+\n+Big f1()\n+{\n+ Big b;\n+ #pragma omp allocate(b)\n+ return b;\n+}\ndiff --git a/gcc/testsuite/g++.dg/gomp/allocate-5.C b/gcc/testsuite/g++.dg/gomp/allocate-5.C\nindex 724dd980138..f1085521fc5 100644\n--- a/gcc/testsuite/g++.dg/gomp/allocate-5.C\n+++ b/gcc/testsuite/g++.dg/gomp/allocate-5.C\n@@ -1,5 +1,4 @@\n /* { dg-additional-options \"-fdump-tree-gimple\" } */\n-/* { dg-skip-if \"\" { ilp32 } } */\n \n #include \"allocate-allocator-handle.h\"\n \n@@ -55,7 +54,7 @@ struct S0 {\n };\n \n struct S1 {\n- int _v[2];\n+ int _v[32];\n S1(int v) : _v() {\n int *end = _v + sizeof(_v) / sizeof(*_v);\n for (int *it = _v; it != end; ++it)\ndiff --git a/gcc/testsuite/g++.dg/gomp/allocate-6.C b/gcc/testsuite/g++.dg/gomp/allocate-6.C\nindex eb0c78a24db..d33b7d53097 100644\n--- a/gcc/testsuite/g++.dg/gomp/allocate-6.C\n+++ b/gcc/testsuite/g++.dg/gomp/allocate-6.C\n@@ -1,5 +1,4 @@\n /* { dg-do compile { target c++11 } } */\n-/* { dg-skip-if \"\" { ilp32 } } */\n /* { dg-additional-options \"-fdump-tree-gimple\" } */\n \n #include \"allocate-allocator-handle.h\"\n@@ -23,7 +22,7 @@ struct S0 {\n };\n \n struct S1 {\n- int _v[2];\n+ int _v[32];\n S1(int v) : _v() {\n int *end = _v + sizeof(_v) / sizeof(*_v);\n for (int *it = _v; it != end; ++it)\ndiff --git a/gcc/testsuite/g++.dg/gomp/allocate-7.C b/gcc/testsuite/g++.dg/gomp/allocate-7.C\nindex 01fc5b84014..16cc5843d1b 100644\n--- a/gcc/testsuite/g++.dg/gomp/allocate-7.C\n+++ b/gcc/testsuite/g++.dg/gomp/allocate-7.C\n@@ -1,5 +1,4 @@\n /* { dg-do compile { target c++20 } } */\n-/* { dg-skip-if \"\" { ilp32 } } */\n /* { dg-additional-options \"-fdump-tree-gimple\" } */\n \n #include \"allocate-allocator-handle.h\"\n@@ -37,8 +36,11 @@ struct S0 {\n };\n \n struct S1 {\n- int _v[2];\n- S1(int v) : _v{v, v} {}\n+ int _v[32];\n+ S1(int v) : _v{v, v, v, v, v, v, v, v,\n+\t\t v, v, v, v, v, v, v, v,\n+\t\t v, v, v, v, v, v, v, v,\n+\t\t v, v, v, v, v, v, v, v} {}\n operator int() const { return 42; }\n };\n \n", "prefixes": [ "07/12" ] }