Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2227949/?format=api
{ "id": 2227949, "url": "http://patchwork.ozlabs.org/api/patches/2227949/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260424150116.1751690-1-ppalka@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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": "<20260424150116.1751690-1-ppalka@redhat.com>", "list_archive_url": null, "date": "2026-04-24T15:01:16", "name": "c++/modules: defer completion of streamed-in cNTTPs [PR124953]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d3295823a04e49f92a6fb6d6781bf1ab915980cd", "submitter": { "id": 78319, "url": "http://patchwork.ozlabs.org/api/people/78319/?format=api", "name": "Patrick Palka", "email": "ppalka@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260424150116.1751690-1-ppalka@redhat.com/mbox/", "series": [ { "id": 501380, "url": "http://patchwork.ozlabs.org/api/series/501380/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501380", "date": "2026-04-24T15:01:16", "name": "c++/modules: defer completion of streamed-in cNTTPs [PR124953]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501380/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227949/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227949/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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=h+3fohZP;\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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=h+3fohZP", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com", "sourceware.org; spf=pass smtp.mailfrom=redhat.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124" ], "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 4g2GQ94t6Hz1yDD\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2026 01:01:53 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 951644BB58CF\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 15:01:51 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 9F67A4BA7998\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 15:01:24 +0000 (GMT)", "from mail-qv1-f72.google.com (mail-qv1-f72.google.com\n [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-67-sIms_h2JN8emb3Z0to9Glw-1; Fri, 24 Apr 2026 11:01:22 -0400", "by mail-qv1-f72.google.com with SMTP id\n 6a1803df08f44-8b02ea0c595so15581316d6.0\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 08:01:21 -0700 (PDT)", "from idea ([2600:4040:aa66:bf00:9e8e:99ff:fed1:71f])\n by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8b02aea5ebcsm188569566d6.44.2026.04.24.08.01.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 24 Apr 2026 08:01:17 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 951644BB58CF", "OpenDKIM Filter v2.11.0 sourceware.org 9F67A4BA7998" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 9F67A4BA7998", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 9F67A4BA7998", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777042884; cv=none;\n b=J7Ut/KofaXNXG0URUQ9eIW+pd5MahtuRjV9oOcsF+qJz4ep7dYoJzV12yxnIUPSLbSlZ/yH9mhiIQtAHrd8imm1grIBPsGmm3RIG+NT3h5muC0d2VHBqrVLWbrHFu7RJ06yxqPGKiXcdjlLeA743TceH8h5LRhZCpnCBahWCvq8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777042884; c=relaxed/simple;\n bh=ALHcBMm1FqdkFE43quM11UqgDGXv84b3FIII4Hk/lcQ=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=AVqHqzWY5SrB8c/74eL1JQdshIJis/RAoV1ahL2NqQ5Kw6CfMMLRrHzfHpkmlwxYshD7iFWvauvplLvkIL58+Bc1KGPku2Id/HWoy3qqYzkrElx6NdxaiugAi+YyfX1R6Z2k14UKWSsix8GsHUnVVek1On+/BJV5KPoRka+CuDY=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777042884;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=sFrIfgs931HzQVN2s81wbzPIKuarrsv3wVPXPH0P6+g=;\n b=h+3fohZPGC2jEGtJKeUMjaAoElV3yO55TrLcXuptyLvF2c5QWoO5YzCNOqrKJytZw4b/hG\n onn1HNduwcvPn5UbPD8VVS4tRFWxxwAgHnaySrmBzrG9ZMeRijaza63D1RQnFD33H+m5OO\n zKQ2BGt/WxOYqoToNY7TV4/Xc2cUIcM=", "X-MC-Unique": "sIms_h2JN8emb3Z0to9Glw-1", "X-Mimecast-MFC-AGG-ID": "sIms_h2JN8emb3Z0to9Glw_1777042880", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777042880; x=1777647680;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=sFrIfgs931HzQVN2s81wbzPIKuarrsv3wVPXPH0P6+g=;\n b=AuntELwbq98yhi7B6AbQJ/tWdmBAjAiiANebyLNwAsuMo79ac7Ca31srte5hLT1ZSj\n ZnBYWwE/T1j5cOI4w0MZUFNoYAEaGpMjf7LWYKvPlvDlHtMYhZgZWPBuq7LUdnQ17xGe\n NqgBudosUEzUay1tiySYIPane9BKx/HOug7YjYdf7ZmlyhnVxp4dRP9PbHgJDNhzU8b9\n /UGNWXPZZXKqn2jqYrk9a9bXTrzGUfHbAXHAM6RDc/7ZljRovReWrUo1d/e2eaaen87g\n 3LqA4KsFV+SsRVYS7AZtawPTTtWR9zSbSbE8WnqRXGfObF1SI0MW+xe1QZ6Bd/Ix5jpx\n zqmw==", "X-Gm-Message-State": "AOJu0Ywk+By+c4ERdJOH00cTUbvbSiHqGRgsEgIZNM3v8sV6W3me/PvW\n yjcT+8EhYfRCV9ZyYlYxc85cHjBE49DtNrLeVX3SAPYHY80+tqagOn0wsM+j78jcfV0qs7Z5BnX\n M0VGqXhuMhbozMBMf9LsQt7avkow4ROyABS8iM9aa3SNZsE4v0NXVnGp4rFGJR7pYhRu/fuydub\n 31FZWRDGni7rUeTeTJH422Z9VVbxU+kGv/NUQk+2J9", "X-Gm-Gg": "AeBDieuCoOdV+hdjai1XpoH/tjY5e/cThmM53jlF3HhVW9uSlZU7bDtQ0ckm9wARctP\n T37KIYLUbVIyrW3xDi3rNj+F3d4qG44M4LweC5wy2CY5MUuv/eUxqLrBgRDZiT+IFebQJxmGCpx\n c+NQVKbwoEDd9Zg9lNo0KsJtSDPxJ96fHZ5euVW1Dg7Wh/FWu71pPW6xbY0D7Olbmey0z+JJxP2\n 65xYErHJRXVVKyFEZx6Jl5GWL8Oog5qK4cweYGeITzreqD5L5x6SCBSZP0GW4mYGxMIX2torLOm\n f+DXkR5AWNjrV6ivV2d5qa+WavnhJecW1tj6xeAfYB0IhVQyNUesFhNmbIa+LmqbJKW/38MB0lk\n nEEUjXxIn3HQ3pG5BKZ20PZw=", "X-Received": [ "by 2002:a05:6214:629:b0:8ac:4fd1:2d5d with SMTP id\n 6a1803df08f44-8b0281d4c8amr361096396d6.5.1777042879373;\n Fri, 24 Apr 2026 08:01:19 -0700 (PDT)", "by 2002:a05:6214:629:b0:8ac:4fd1:2d5d with SMTP id\n 6a1803df08f44-8b0281d4c8amr361095826d6.5.1777042878371;\n Fri, 24 Apr 2026 08:01:18 -0700 (PDT)" ], "From": "Patrick Palka <ppalka@redhat.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "jason@redhat.com,\n\tnshead@gcc.gnu.org,\n\tPatrick Palka <ppalka@redhat.com>", "Subject": "[PATCH] c++/modules: defer completion of streamed-in cNTTPs\n [PR124953]", "Date": "Fri, 24 Apr 2026 11:01:16 -0400", "Message-ID": "<20260424150116.1751690-1-ppalka@redhat.com>", "X-Mailer": "git-send-email 2.54.0.rc1.54.g60f07c4f5c", "MIME-Version": "1.0", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "LJ1b1pfIgT0dpMFhA7STw5-cAna_XXyWdpvWdwMeHjI_1777042880", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true", "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": "Tested on x86_64-pc-linux-gnu, does this look OK for trunk/16.2?\n\n-- >8 --\n\nHere we hit lazy loading recursion when streaming in the cNTTP object\nwrap<Storage>{}, via get_template_parm_object -> cp_finish_decl ->\nensure_literal_type_for_constexpr_object -> complete_type, apparently\nthe class definition of wrap<Storage> hasn't been streamed in yet.\nIf we disable that literal type check for NTTP objects, we still hit\nrecursion, from layout_var_decl.\n\nIt seems prudent to defer calling cp_finish_decl for NTTP objects until\nafter lazy loading has completed like we do for expand_or_defer_fn and\ncdtors. This patch arranges that, as a follow-up to the previous fixes\nr15-3031 and r16-318 for NTTP object streaming.\n\n\tPR c++/124953\n\ngcc/cp/ChangeLog:\n\n\t* module.cc (trees_in::tree_node) <tt_nttp_var>: Push the result\n\tof get_template_parm_object to post_load_decls.\n\t(post_load_processing): Call cp_finish_decl on any not yet\n\tcompleted NTTP objects.\n\t* pt.cc (get_template_parm_object): Don't call cp_finish_decl\n\twhen !check_init.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/modules/tpl-nttp-3_a.H: New test.\n\t* g++.dg/modules/tpl-nttp-3_b.C: New test.\n---\n gcc/cp/module.cc | 12 ++++++++++++\n gcc/cp/pt.cc | 3 +++\n gcc/testsuite/g++.dg/modules/tpl-nttp-3_a.H | 11 +++++++++++\n gcc/testsuite/g++.dg/modules/tpl-nttp-3_b.C | 5 +++++\n 4 files changed, 31 insertions(+)\n create mode 100644 gcc/testsuite/g++.dg/modules/tpl-nttp-3_a.H\n create mode 100644 gcc/testsuite/g++.dg/modules/tpl-nttp-3_b.C", "diff": "diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc\nindex 98a285201d00..4d6df0564d91 100644\n--- a/gcc/cp/module.cc\n+++ b/gcc/cp/module.cc\n@@ -10872,6 +10872,7 @@ trees_in::tree_node (bool is_use)\n \t int tag = insert (res);\n \t dump (dumper::TREE)\n \t && dump (\"Created nttp object:%d %N\", tag, name);\n+\t vec_safe_push (post_load_decls, res);\n \t }\n }\n break;\n@@ -20531,6 +20532,17 @@ post_load_processing ()\n \n dump () && dump (\"Post-load processing of %N\", decl);\n \n+ if (VAR_P (decl) && DECL_NTTP_OBJECT_P (decl))\n+\t{\n+\t if (!DECL_SIZE (decl))\n+\t {\n+\t push_to_top_level ();\n+\t cp_finish_decl (decl, DECL_INITIAL (decl), false, NULL_TREE, 0);\n+\t pop_from_top_level ();\n+\t }\n+\t continue;\n+\t}\n+\n gcc_checking_assert (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl));\n expand_or_defer_fn (decl);\n /* As in module_state::read_cluster. */\ndiff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex fca63d3950dd..ce324c87ecf8 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -7582,6 +7582,9 @@ get_template_parm_object (tree expr, tree name, bool check_init/*=true*/)\n /* FIXME setting TREE_CONSTANT on refs breaks the back end. */\n if (!TYPE_REF_P (type))\n \tTREE_CONSTANT (decl) = true;\n+ pushdecl_top_level (decl);\n+ /* The caller must call cp_finish_decl to complete its processing. */\n+ return decl;\n }\n \n pushdecl_top_level_and_finish (decl, expr);\ndiff --git a/gcc/testsuite/g++.dg/modules/tpl-nttp-3_a.H b/gcc/testsuite/g++.dg/modules/tpl-nttp-3_a.H\nnew file mode 100644\nindex 000000000000..1b28780b14b6\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/modules/tpl-nttp-3_a.H\n@@ -0,0 +1,11 @@\n+// PR c++/124953\n+// { dg-do compile { target c++20 } }\n+// { dg-additional-options \"-fmodule-header\" }\n+\n+template <class T> struct wrap { using type = T; };\n+template <auto V> using unwrap = decltype(V)::type;\n+\n+struct Foo {\n+ struct Storage {};\n+ unwrap<wrap<Storage>{}> data_{};\n+};\ndiff --git a/gcc/testsuite/g++.dg/modules/tpl-nttp-3_b.C b/gcc/testsuite/g++.dg/modules/tpl-nttp-3_b.C\nnew file mode 100644\nindex 000000000000..2a51186c64d3\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/modules/tpl-nttp-3_b.C\n@@ -0,0 +1,5 @@\n+// PR c++/124953\n+// { dg-do compile { target c++20 } }\n+// { dg-additional-options \"-fmodules -fno-module-lazy\" }\n+\n+import \"tpl-nttp-3_a.H\";\n", "prefixes": [] }