Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2233043/?format=api
{ "id": 2233043, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233043/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260505151030.1749548-12-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-12-waffl3x@baylibre.com>", "list_archive_url": null, "date": "2026-05-05T15:02:04", "name": "[11/12] OpenMP/C++: Sorry for allocate directive in omp::decl attribute", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "78942d74ec8c4dd561c2a4c5c72df4ae15f365c0", "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-12-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/2233043/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2233043/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=g3oFmBcN;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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=g3oFmBcN", "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::1034" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4g928K01XHz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 01:13:20 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 2FF604BA903A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 5 May 2026 15:13:19 +0000 (GMT)", "from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com\n [IPv6:2607:f8b0:4864:20::1034])\n by sourceware.org (Postfix) with ESMTPS id 2F2904BA9001\n for <gcc-patches@gcc.gnu.org>; Tue, 5 May 2026 15:10:48 +0000 (GMT)", "by mail-pj1-x1034.google.com with SMTP id\n 98e67ed59e1d1-3650cb6e128so552812a91.2\n for <gcc-patches@gcc.gnu.org>; Tue, 05 May 2026 08:10:48 -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.46\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 05 May 2026 08:10:46 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 2FF604BA903A", "OpenDKIM Filter v2.11.0 sourceware.org 2F2904BA9001" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 2F2904BA9001", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 2F2904BA9001", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777993848; cv=none;\n b=JxiGn44wZXYHTC++pFc7rtxH5kgp45bKJoIfQnfgHbTr7fcNtzZ3/a8Xrkw+VEUN0oWo/mMF7rvcDMsFCum9+gSgJ3a6NiLXWGbeKHcuBlFhRhz3XFnKHLvkVvEEQWelwEGMIr0WNe6XMQ9k9FCoX2kvTm8Mo52FrJRFQ502Ha8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777993848; c=relaxed/simple;\n bh=Fu5hue4nOoQbN38kOhw55qpW7vheHt6HsPPpJz304sk=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=h13/qv1SwqBV2nx7ydouSJrhQwewCkMruiwd38KIGHWm4aERCuGhpfFGUxImNBfvGMcU8nXDeGoqeFJvgXoFoV7sgQg3k9zQz2lp6GJ7a0DHlkBII3AHIcPcKlcolcIeydqv8HrgFKkgOWU7x9ef4AS8HAAkJbbSpm5jnbSsj8E=", "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=1777993847;\n x=1778598647;\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=L7m2/TU2/q2BwY/38b5RA6XgvH3l/1DDKi+ky8SR6oc=;\n b=g3oFmBcNQUkch4guf24TTyV8SNSuJpZD1joKGvYqlAci2WFG45ei9+9N1cOYW2ueAo\n z/KPYGSMToijOYQ07hje9RKx612kzvmSBKnSDu8d6Qak5+Et5NqipvuTm2StrrXsk1oZ\n OR6MihOvt6d/Bf0roib4ceOW02TEtjKicjIc/LIowBk7pmsGCVtYjrc282Rl6KjTNaFA\n XSGbbwlUnj2gSOY8Zwuipt6/68rWsyMSp2MR5msqCnU3/pGsrA4Me2vyVZ0Il/Eadykk\n HFqrAfVujOTd05TM4NLOsWbSTfDgCZKi0ZGNDDLCkYhN9X0Czh4Ffh6POKh1WwUtb95J\n 6caw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777993847; x=1778598647;\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=L7m2/TU2/q2BwY/38b5RA6XgvH3l/1DDKi+ky8SR6oc=;\n b=JIKh+U7SVKp7gc/KqGVrsUIjy0XvDn8mv/618sPUz2Jvm76ZTQyb5U5kxMm8L5bHNx\n wVdei8/aqAATBfQ4UJUy5XkbMbNt8oDmdUt6hFdtBnIno/Zc5rVaJfNMuMrLVRE63JvE\n IpDOMmev1j+hEZg5FtHEkAYRf5DV4NIFrIUU4V2uEFL7xudgzLvC3pk+DlhoIHqyBfP8\n ZfqkDJVRsB59b6+h1mRlYagDroxsSAopBZPy5UWaBUENkkLTDz9GznRUQDALOiWJlXja\n Jxfm8y5UBHbL6DcOjAZl6P5gmjqBRGOoVqy/ebsaME9Bh1zYlKufAGC/v80aKXEEtFoM\n PYbA==", "X-Gm-Message-State": "AOJu0YyrVInyKX/ZgsMT9EfVTiz5IbTnPyeyGhUJKEF1Y7Q+e0zjIOxA\n BIk737Qg9VJugN2Y4Nsq/vIb18hYm99Vml6yCnSisw+bikH0O/Swjqy+1IYsDy14sQWZ7+WXXex\n 4gU+R", "X-Gm-Gg": "AeBDietekhGG0fuMzWHdROfLrOBsT81Fmw7sk8co3M8/TNjb3djbXe37JseTwT3QxSQ\n wmbURWMcfsbzEbkC0GL0aDl2WtqiX9lnoPh0UsM1OKUQguAaaQqzNOofFB7eFlC0ZuGWbGKR8x1\n s8GLbLL+6qWfz9PpIY3i/n6s/akdUurGivpqVijujpPvMDgZ/ld+FpeU6iIAyL10ZnGt0mNtm3s\n //FgS+oHcDhnV5aVFbGyk61Z6jEpodzRpcvNGVW/1eD0of26zqRLBv8U90fFriiasvP8B/vNBvu\n kn95CfI1ucfL0DigTU81vhdhn7IJo78K+wIzEvdxcE7TFNe37UOE2ZcRTXHTPXIkLYJiJ2jQz7Z\n OckBFNDXB0zUcye1plJ72t00YSP4wxngEInFMyguVGPNk8oIJc1VHJ3jvsJ7XzQm00vw3R5ucOg\n +SD6u8Bjp6OcL1Up7XlczIvnHHnMUARxnGOgybRoeYnlIkNze8xA==", "X-Received": "by 2002:a05:6a21:6b87:b0:3a1:6a7c:dba5 with SMTP id\n adf61e73a8af0-3aa3e9862e3mr1874635637.6.1777993847045;\n Tue, 05 May 2026 08:10:47 -0700 (PDT)", "From": "Waffl3x <waffl3x@baylibre.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Waffl3x <waffl3x@baylibre.com>", "Subject": "[PATCH 11/12] OpenMP/C++: Sorry for allocate directive in omp::decl\n attribute", "Date": "Tue, 5 May 2026 09:02:04 -0600", "Message-ID": "<20260505151030.1749548-12-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-Type": "text/plain; charset=UTF-8", "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": "At least one of the diagnostics in cp_parser_omp_allocate expects each decl\nto have been pushed into the current binding level. Due to when attributes\nare parsed this assumption does not hold for an allocate directive\nspecified in an omp::decl attribute. The broken diagnostic checks that the\nvars listed in an allocate directive are in the same scope as the directive.\nObviously we can assume that is the case when using omp::decl, but it is not\nobvious how to detect that we in an omp::decl in a robust way so this case\nis simply not supported for now.\n\nThis patch also adds a check for TREE_PUBLIC in cp_maybe_parse_omp_decl.\nDuring investigation of this issue it was noticed that TREE_PUBLIC denotes\nan omp::decl attribute as opposed to an omp::directive attribute, thus it is\nalso a precondition in that function.\n\ngcc/cp/ChangeLog:\n\n\t* parser.cc (cp_maybe_parse_omp_decl): Sorry for allocate directive.\n\nlibgomp/ChangeLog:\n\n\t* testsuite/libgomp.c-c++-common/allocate-7.c: Disable for C++.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/gomp/omp-constexpr.C: Add sorry for allocate directive.\n\t* g++.dg/gomp/allocate-24.C: New test.\n\nSigned-off-by: Waffl3x <waffl3x@baylibre.com>\n---\n gcc/cp/parser.cc | 10 ++++++-\n gcc/testsuite/g++.dg/gomp/allocate-24.C | 26 +++++++++++++++++++\n gcc/testsuite/g++.dg/gomp/omp-constexpr.C | 3 ++-\n .../libgomp.c-c++-common/allocate-7.c | 5 +++-\n 4 files changed, 41 insertions(+), 3 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/gomp/allocate-24.C", "diff": "diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 791ac2d6ea9..fe628be065c 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -54410,7 +54410,8 @@ cp_parser_late_parsing_omp_declare_simd (cp_parser *parser, tree attrs,\n bool\n cp_maybe_parse_omp_decl (tree decl, tree d)\n {\n- gcc_assert (TREE_CODE (d) == DEFERRED_PARSE);\n+ gcc_assert (TREE_CODE (d) == DEFERRED_PARSE\n+\t && TREE_PUBLIC (d));\n cp_token *first = DEFPARSE_TOKENS (d)->first;\n cp_token *last = DEFPARSE_TOKENS (d)->last;\n const char *directive[3] = {};\n@@ -54448,6 +54449,13 @@ cp_maybe_parse_omp_decl (tree decl, tree d)\n if (!flag_openmp && !dir->simd)\n return true;\n \n+ if (dir->id == PRAGMA_OMP_ALLOCATE)\n+ {\n+ sorry_at (first->location,\n+\t\t\"allocate directive not supported in %<omp::decl%>\");\n+ return true;\n+ }\n+\n cp_parser *parser = the_parser;\n cp_lexer *lexer = cp_lexer_alloc ();\n lexer->debugging_p = parser->lexer->debugging_p;\ndiff --git a/gcc/testsuite/g++.dg/gomp/allocate-24.C b/gcc/testsuite/g++.dg/gomp/allocate-24.C\nnew file mode 100644\nindex 00000000000..114231c8a54\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/gomp/allocate-24.C\n@@ -0,0 +1,26 @@\n+/* { dg-do compile { target c++11 } } */\n+\n+#include \"allocate-allocator-handle.h\"\n+\n+/* TODO: Add scan-tree-dump checks once support for omp::decl is added. */\n+\n+int AAA [[omp::decl(allocate,allocator(omp_low_lat_mem_alloc),align(4096))]];\n+/* { dg-message \"allocate directive not supported in 'omp::decl'\" \"\" { target *-*-* } .-1 } */\n+\n+static_assert (alignof(AAA) == alignof(int), \"wrong alignment\");\n+\n+void f ()\n+{\n+ /* This applies to A1 and B1.\n+ (C++23 N4950 §9.1.3, sentence 5)\n+ The attribute-specifier-seq appertains to each of the entities declared by\n+ the declarators of the init-declarator-list. */\n+ [[omp::decl(allocate, align(4096))]] int A1[5], B1;\n+ /* { dg-message \"allocate directive not supported in 'omp::decl'\" \"\" { target *-*-* } .-1 } */\n+\n+ static_assert (alignof(A1) == alignof(int[5]), \"wrong alignment\");\n+ static_assert (alignof(B1) == alignof(int), \"wrong alignment\");\n+\n+ static int BBB [[omp::decl(allocate,allocator(omp_low_lat_mem_alloc),align(4096))]];\n+ /* { dg-message \"allocate directive not supported in 'omp::decl'\" \"\" { target *-*-* } .-1 } */\n+}\ndiff --git a/gcc/testsuite/g++.dg/gomp/omp-constexpr.C b/gcc/testsuite/g++.dg/gomp/omp-constexpr.C\nindex 0d984d8609b..85b1157201c 100644\n--- a/gcc/testsuite/g++.dg/gomp/omp-constexpr.C\n+++ b/gcc/testsuite/g++.dg/gomp/omp-constexpr.C\n@@ -31,7 +31,8 @@ h ()\n constexpr int\n i ()\n {\n- int a [[omp::decl(allocate, align(128))]] = 42; /* { dg-error \"OpenMP directives may not appear in 'constexpr' functions\" } */\n+ int a [[omp::decl(allocate, align(128))]] = 42; /* { dg-error \"OpenMP directives may not appear in 'constexpr' functions\" \"\" { xfail *-*-* } } */\n+ /* { dg-message \"allocate directive not supported in 'omp::decl'\" \"\" { target *-*-* } .-1 } */\n return a;\n } // { dg-error \"not a return-statement\" \"\" { target c++11_down } }\n \ndiff --git a/libgomp/testsuite/libgomp.c-c++-common/allocate-7.c b/libgomp/testsuite/libgomp.c-c++-common/allocate-7.c\nindex 9968eb19005..8d5429b0eb3 100644\n--- a/libgomp/testsuite/libgomp.c-c++-common/allocate-7.c\n+++ b/libgomp/testsuite/libgomp.c-c++-common/allocate-7.c\n@@ -1,9 +1,12 @@\n-/* { dg-do run } */\n+/* { dg-do run { target c } } */\n+\n+/* In C++, omp allocate in an omp::decl attribute is not currently supported. */\n \n #include <omp.h>\n \n int AAA [[omp::decl(allocate,allocator(omp_low_lat_mem_alloc),align(4096))]];\n \n+\n #ifndef __cplusplus\n _Static_assert (_Alignof(AAA) == _Alignof(int), \"wrong alignment\");\n #elif __cplusplus >= 201103L\n", "prefixes": [ "11/12" ] }