Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2197086/?format=api
{ "id": 2197086, "url": "http://patchwork.ozlabs.org/api/patches/2197086/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260217030501.1284440-1-dmalcolm@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": "<20260217030501.1284440-1-dmalcolm@redhat.com>", "list_archive_url": null, "date": "2026-02-17T03:05:01", "name": "[pushed:,r16-7536] c++: fix missing file:line:column on \"required from here\" [PR122001]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c17918f1dd329c1f381ee8a9961826600d7a345e", "submitter": { "id": 24465, "url": "http://patchwork.ozlabs.org/api/people/24465/?format=api", "name": "David Malcolm", "email": "dmalcolm@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260217030501.1284440-1-dmalcolm@redhat.com/mbox/", "series": [ { "id": 492366, "url": "http://patchwork.ozlabs.org/api/series/492366/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=492366", "date": "2026-02-17T03:05:01", "name": "[pushed:,r16-7536] c++: fix missing file:line:column on \"required from here\" [PR122001]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492366/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2197086/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197086/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=YoOkE2Ji;\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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=YoOkE2Ji", "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.133.124" ], "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 4fFPff2cNBz1xwD\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 14:06:02 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 6B8754BAD17F\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 03:06:00 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 199584BAD169\n for <gcc-patches@gcc.gnu.org>; Tue, 17 Feb 2026 03:05:07 +0000 (GMT)", "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-Nl-UZs9EPwekbWZtyKVuKg-1; Mon,\n 16 Feb 2026 22:05:04 -0500", "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id D2F881800366\n for <gcc-patches@gcc.gnu.org>; Tue, 17 Feb 2026 03:05:03 +0000 (UTC)", "from t14s.localdomain.com (unknown [10.22.88.22])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 567751800669; Tue, 17 Feb 2026 03:05:03 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 6B8754BAD17F", "OpenDKIM Filter v2.11.0 sourceware.org 199584BAD169" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 199584BAD169", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 199584BAD169", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771297507; cv=none;\n b=tqOMXKRz/fHQIVdbuHWTt1p3+VgBMGJs+qyXUgAL0bUQKi7azGXB+jiUgKMZeFzmyOABdNsDtTjcLlUpzEdHp26YIGSuN1V/pFmVl/NTRbnytUXJ+DVPBgCL6U5gEi2ZUnkrMMjDqVA2KyzMrWViW1l0q5YY0dsiGn94hwxQhc4=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1771297507; c=relaxed/simple;\n bh=Wq8lo19XohdzkLgHZyWhHvSkmgYvhc+/Y6P00OjGnGU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=IHq/HF2fmAg+oxBCv9grGz2mr+3wgMKybie7qhCn8AsBBHhc3nU4dnTqItgO5fM02KQTUYuE+6U3X7IDfOH8xIM3+TSTxyShfZzDmvHeoJkig0TOUs8m6ir5GP/tKhYJAkYs343mr4u8cZ+jaJhHWcekWQ7JVg/ucI6pz6cRX8Q=", "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=1771297506;\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=I1Pgw0bI2tnphL21jUoQt+LFf6BnWhS2r/3kQBvnKUg=;\n b=YoOkE2JitOH64xee2mxhqiOH4Kr2tMhHiti4KM/xBZGAmQP2h1rZh6KArQn8RITHAWYqSe\n H9kSeX4BoHLVaxAVnZ/Oxj4mJGr+6Pxf2omU8IjwGqOZSugMRSNuCvXLA94zBjYDNU1afK\n g2pVw5BvQUPgjxNzJhZUroteGAj5wYM=", "X-MC-Unique": "Nl-UZs9EPwekbWZtyKVuKg-1", "X-Mimecast-MFC-AGG-ID": "Nl-UZs9EPwekbWZtyKVuKg_1771297504", "From": "David Malcolm <dmalcolm@redhat.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "David Malcolm <dmalcolm@redhat.com>", "Subject": "[pushed: r16-7536] c++: fix missing file:line:column on \"required\n from here\" [PR122001]", "Date": "Mon, 16 Feb 2026 22:05:01 -0500", "Message-ID": "<20260217030501.1284440-1-dmalcolm@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "2nkQT7sZB8xvE3zmre9-e_xUL8J6pZI3mbXqTIoF1u4_1771297504", "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": "PR diagnostics/122001 notes that in GCC 15 we emit:\n\n<source>: In instantiation of 'void foo(T) [with T = std::nullptr_t]':\n<source>:7:8: required from here\n 7 | foo(nullptr);\n | ~~~^~~~~~~~~\n<source>:3:7: error: invalid operands of types 'int' and 'std::nullptr_t' to binary 'operator+'\n 3 | 1 + t;\n | ~~^~~\n\nwhereas in GCC 16 we emit:\n\n<source>: In instantiation of 'void foo(T) [with T = std::nullptr_t]':\nrequired from here\n<source>:7:8:\n 7 | foo(nullptr);\n | ~~~^~~~~~~~~\n<source>:3:7: error: invalid operands of types 'int' and 'std::nullptr_t' to binary 'operator+'\n 3 | 1 + t;\n | ~~^~~\n\nwhere the \"required from line\" has lost its file:line:column prefix,\nwith the latter appearing on a follow line.\n\nThe root cause is that in r15-5995-g339246fb9ef4ca I changed\ncp/error.cc's print_instantiation_partial_context_line from using\nprint_location to using auto_context_line, so that the location\ninformation would be better integrated with nested diagnostics,\nand enabled this by default in r16-3092-gd3fe5a560f0bcc.\n\ntext_sink::build_indent_prefix is returning the empty string for such\nlines, rather than an indented bullet point.\n\nThis patch tweaks things so that such lines print the location before\nthe message at the top nesting level, and on a separate line at nested\nnesting levels, and always the latter with\n-fno-diagnostics-show-nesting.\n\nSuccessfully bootstrapped & regrtested on x86_64-pc-linux-gnu.\nPushed to trunk as r16-7536-g6e52c1dbfb77ed.\n\ngcc/cp/ChangeLog:\n\tPR diagnostics/122001\n\t* error.cc (auto_context_line::auto_context_line): Initialize\n\tm_nesting_level and m_location_printed. Update the condition\n\tfor printing location in ctor to also do it at top-level\n\tnesting level. Record into m_location_printed if we did\n\tprint the location.\n\t(auto_context_line::~auto_context_line): Don't call print_location\n\tif we already printed it in the ctor.\n\t(auto_context_line::m_nesting_level): New field.\n\t(auto_context_line::m_location_printed): New field.\n\ngcc/testsuite/ChangeLog:\n\tPR diagnostics/122001\n\t* g++.dg/diagnostic/instantiation-context-pr122001-1.C: New test.\n\t* g++.dg/diagnostic/instantiation-context-pr122001-2.C: New test.\n\nSigned-off-by: David Malcolm <dmalcolm@redhat.com>\n---\n gcc/cp/error.cc | 23 ++++++++++++++-----\n .../instantiation-context-pr122001-1.C | 13 +++++++++++\n .../instantiation-context-pr122001-2.C | 13 +++++++++++\n 3 files changed, 43 insertions(+), 6 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-1.C\n create mode 100644 gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-2.C", "diff": "diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc\nindex e64da242152ec..25e438c1784da 100644\n--- a/gcc/cp/error.cc\n+++ b/gcc/cp/error.cc\n@@ -4091,13 +4091,18 @@ public:\n \t\t bool show_locus = false)\n : m_text_output (text_output),\n m_loc (loc),\n- m_show_locus (show_locus)\n+ m_show_locus (show_locus),\n+ m_nesting_level (text_output.get_context ().get_diagnostic_nesting_level ()),\n+ m_location_printed (false)\n {\n char *indent = m_text_output.build_indent_prefix (true);\n pp_verbatim (m_text_output.get_printer (), indent);\n free (indent);\n- if (!m_text_output.show_nesting_p ())\n- print_location (m_text_output, m_loc);\n+ if (m_nesting_level == 0 || !m_text_output.show_nesting_p ())\n+ {\n+\tprint_location (m_text_output, m_loc);\n+\tm_location_printed = true;\n+ }\n }\n ~auto_context_line ()\n {\n@@ -4107,9 +4112,13 @@ public:\n \tif (m_text_output.show_locations_in_nesting_p ())\n \t {\n \t char *indent = m_text_output.build_indent_prefix (false);\n-\t pp_verbatim (pp, indent);\n-\t print_location (m_text_output, m_loc);\n-\t pp_newline (pp);\n+\t if (!m_location_printed)\n+\t {\n+\t\tpp_verbatim (pp, indent);\n+\t\tprint_location (m_text_output, m_loc);\n+\t\tpp_newline (pp);\n+\t\tm_location_printed = true;\n+\t }\n \n \t char *saved_prefix = pp_take_prefix (pp);\n \t pp_set_prefix (pp, indent);\n@@ -4137,6 +4146,8 @@ private:\n diagnostics::text_sink &m_text_output;\n location_t m_loc;\n bool m_show_locus;\n+ int m_nesting_level;\n+ bool m_location_printed;\n };\n \n /* Helper function of print_instantiation_partial_context() that\ndiff --git a/gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-1.C b/gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-1.C\nnew file mode 100644\nindex 0000000000000..a1e888a779904\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-1.C\n@@ -0,0 +1,13 @@\n+// { dg-additional-options \"-fdiagnostics-show-nesting\" }\n+\n+template <typename T>\n+void foo(T t) {\n+ 1 + t; // { dg-error \"pointer-arith\" }\n+}\n+\n+int main() {\n+ foo((void *)0);\n+}\n+\n+// Verify that we print the file/line/column before the \"required from here\"\n+// { dg-regexp \".*instantiation-context-pr122001-1.C:9:6: required from here\" }\ndiff --git a/gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-2.C b/gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-2.C\nnew file mode 100644\nindex 0000000000000..03edeb12068f2\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/diagnostic/instantiation-context-pr122001-2.C\n@@ -0,0 +1,13 @@\n+// { dg-additional-options \"-fno-diagnostics-show-nesting\" }\n+\n+template <typename T>\n+void foo(T t) {\n+ 1 + t; // { dg-error \"pointer-arith\" }\n+}\n+\n+int main() {\n+ foo((void *)0);\n+}\n+\n+// Verify that we print the file/line/column before the \"required from here\"\n+// { dg-regexp \".*instantiation-context-pr122001-2.C:9:6: required from here\" }\n", "prefixes": [ "pushed:", "r16-7536" ] }