Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194795/?format=api
{ "id": 2194795, "url": "http://patchwork.ozlabs.org/api/patches/2194795/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260209234830.525356-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": "<20260209234830.525356-1-dmalcolm@redhat.com>", "list_archive_url": null, "date": "2026-02-09T23:48:30", "name": "[pushed:,r16-7422] sarif output: Fix ICE due to overzealous caching [PR124014]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0b7a3a5de8ba07fc38dcc7f849970bcb3a90930f", "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/20260209234830.525356-1-dmalcolm@redhat.com/mbox/", "series": [ { "id": 491582, "url": "http://patchwork.ozlabs.org/api/series/491582/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491582", "date": "2026-02-09T23:48:30", "name": "[pushed:,r16-7422] sarif output: Fix ICE due to overzealous caching [PR124014]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491582/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194795/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194795/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=VT621ize;\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=VT621ize", "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 4f91cg02rJz1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 10:49:06 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id DB38C4CF31FF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 9 Feb 2026 23:49:04 +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 401E84C3184B\n for <gcc-patches@gcc.gnu.org>; Mon, 9 Feb 2026 23:48:36 +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-630-aNeRuN2eOiWjwerfId9AHw-1; Mon,\n 09 Feb 2026 18:48:34 -0500", "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\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 A6A1D180057E\n for <gcc-patches@gcc.gnu.org>; Mon, 9 Feb 2026 23:48:33 +0000 (UTC)", "from t14s.localdomain.com (unknown [10.22.80.18])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id B50921800464; Mon, 9 Feb 2026 23:48:32 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org DB38C4CF31FF", "OpenDKIM Filter v2.11.0 sourceware.org 401E84C3184B" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 401E84C3184B", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 401E84C3184B", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770680916; cv=none;\n b=Ys+oQgp5j4/ErECo6PSRv7ib+RRyJ7Hh3NnOfm67N03UA7ubqsPQFLABu/kTvrevq3jX4I97MphsQygINdQg5LnRXSllN84PNjMXm3ja/wRdSMRJ8o4UBOOuO3D4qPGa+kqpHeNnFrjbLxPCWPipGL7Wt7vuP2BC+GHNa0THR7U=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770680916; c=relaxed/simple;\n bh=7aPu75vkysIOtp7nUye4YHBzh26rlB/PoGL3Wm3t/A0=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=jqO4KWtueE3c3fn0KGC85zX6M/stLLP+BldXpHoCHzqbG+4ihqf+O3QcTW4tDEDlfKpWPWpYG6+5+wPbFLsLNeyxUGGVIeXt7pSf87i3tAUOIF+WwuTWDjFpHcl/JV1m+eEDEy2Pk/MV2jmySX8B5nXSLLgHRieDoisTfIucfag=", "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=1770680915;\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=fNngcoLX7e4YzuWOjWxcxqeN3a+Cc2bmAOYyxQla1hg=;\n b=VT621izeVyzVJyYV19vGRrlup/3+BSsI4uNvdzW+xq1xLlom58SGOOLrs2pRnDoLq9wCSr\n GtqvTbZ81bngRvhhzQigjkF+oSzgGzzkXUOZO9vammdCt+MTe+TcY85+QD+xgrHpXZ7HkR\n B2z/I1csYYcu4tZItjcMXeV9GmXCxxY=", "X-MC-Unique": "aNeRuN2eOiWjwerfId9AHw-1", "X-Mimecast-MFC-AGG-ID": "aNeRuN2eOiWjwerfId9AHw_1770680913", "From": "David Malcolm <dmalcolm@redhat.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "David Malcolm <dmalcolm@redhat.com>", "Subject": "[pushed: r16-7422] sarif output: Fix ICE due to overzealous caching\n [PR124014]", "Date": "Mon, 9 Feb 2026 18:48:30 -0500", "Message-ID": "<20260209234830.525356-1-dmalcolm@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "J9QpSxpeHJsLH9GaUqHDprQimSuDy34C_c1nvsK8qUA_1770680913", "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/124014 identifies an ICE in sarif output of\ndiagnostics that occur after free_lang_data has called\ntree_diagnostics_defaults, which happens e.g. with lto.\n\nThe issue is that in r16-413-g8ab6899dce92e6 I introduced to sarif_sink\na cached pointer to the logical_locations::manager, which for tree-using\nclients is part of the compiler_data_hooks. Hence for the case above, the\npointer is freed from under the sarif_sink, and any diagnostic\nissued after that point with a current_function_decl will\ntrigger a use-after-free.\n\nFix by removing the cached pointer.\n\nSuccessfully bootstrapped & regrtested on x86_64-pc-linux-gnu.\nPushed to trunk as r16-7422-g13c2da6cdbd1a3.\n\ngcc/ChangeLog:\n\tPR diagnostics/124014\n\t* diagnostics/sarif-sink.cc\n\t(sarif_builder::get_logical_location_manager): Reimplement, to\n\teliminate m_logical_loc_mgr.\n\t(sarif_builder::m_logical_loc_mgr): Drop field.\n\t(sarif_builder::sarif_builder): Update for removed field.\n\t(sarif_builder::set_any_logical_locs_arr): Likewise.\n\t(sarif_builder::ensure_sarif_logical_location_for): Likewise.\n\t(sarif_builder::make_minimal_sarif_logical_location): Likewise.\n\ngcc/testsuite/ChangeLog:\n\tPR diagnostics/124014\n\t* gcc.dg/sarif-output/ice-pr124014.c: New test.\n\nSigned-off-by: David Malcolm <dmalcolm@redhat.com>\n---\n gcc/diagnostics/sarif-sink.cc | 31 +++++++++----------\n .../gcc.dg/sarif-output/ice-pr124014.c | 4 +++\n 2 files changed, 19 insertions(+), 16 deletions(-)\n create mode 100644 gcc/testsuite/gcc.dg/sarif-output/ice-pr124014.c", "diff": "diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc\nindex 8e8947aa026a1..2cd64d65112e9 100644\n--- a/gcc/diagnostics/sarif-sink.cc\n+++ b/gcc/diagnostics/sarif-sink.cc\n@@ -801,7 +801,9 @@ public:\n const logical_locations::manager *\n get_logical_location_manager () const\n {\n- return m_logical_loc_mgr;\n+ if (auto client_data_hooks = m_context.get_client_data_hooks ())\n+ return client_data_hooks->get_logical_location_manager ();\n+ return nullptr;\n }\n \n void\n@@ -994,8 +996,6 @@ private:\n const line_maps *m_line_maps;\n sarif_token_printer m_token_printer;\n \n- const logical_locations::manager *m_logical_loc_mgr;\n-\n /* The JSON object for the invocation object. */\n std::unique_ptr<sarif_invocation> m_invocation_obj;\n \n@@ -1700,7 +1700,6 @@ sarif_builder::sarif_builder (diagnostics::context &dc,\n m_printer (&printer),\n m_line_maps (line_maps),\n m_token_printer (*this),\n- m_logical_loc_mgr (nullptr),\n m_invocation_obj\n (std::make_unique<sarif_invocation> (*this,\n \t\t\t\t\t dc.get_original_argv ())),\n@@ -1721,9 +1720,6 @@ sarif_builder::sarif_builder (diagnostics::context &dc,\n {\n gcc_assert (m_line_maps);\n gcc_assert (m_serialization_format);\n-\n- if (auto client_data_hooks = dc.get_client_data_hooks ())\n- m_logical_loc_mgr = client_data_hooks->get_logical_location_manager ();\n }\n \n sarif_builder::~sarif_builder ()\n@@ -2307,7 +2303,8 @@ set_any_logical_locs_arr (sarif_location &location_obj,\n {\n if (!logical_loc)\n return;\n- gcc_assert (m_logical_loc_mgr);\n+ auto logical_loc_mgr = get_logical_location_manager ();\n+ gcc_assert (logical_loc_mgr);\n auto location_locs_arr = std::make_unique<json::array> ();\n \n auto logical_loc_obj = make_minimal_sarif_logical_location (logical_loc);\n@@ -3061,28 +3058,29 @@ int\n sarif_builder::\n ensure_sarif_logical_location_for (logical_locations::key k)\n {\n- gcc_assert (m_logical_loc_mgr);\n+ auto logical_loc_mgr = get_logical_location_manager ();\n+ gcc_assert (logical_loc_mgr);\n \n auto sarif_logical_loc = std::make_unique<sarif_logical_location> ();\n \n- if (const char *short_name = m_logical_loc_mgr->get_short_name (k))\n+ if (const char *short_name = logical_loc_mgr->get_short_name (k))\n sarif_logical_loc->set_string (\"name\", short_name);\n \n /* \"fullyQualifiedName\" property (SARIF v2.1.0 section 3.33.5). */\n- if (const char *name_with_scope = m_logical_loc_mgr->get_name_with_scope (k))\n+ if (const char *name_with_scope = logical_loc_mgr->get_name_with_scope (k))\n sarif_logical_loc->set_string (\"fullyQualifiedName\", name_with_scope);\n \n /* \"decoratedName\" property (SARIF v2.1.0 section 3.33.6). */\n- if (const char *internal_name = m_logical_loc_mgr->get_internal_name (k))\n+ if (const char *internal_name = logical_loc_mgr->get_internal_name (k))\n sarif_logical_loc->set_string (\"decoratedName\", internal_name);\n \n /* \"kind\" property (SARIF v2.1.0 section 3.33.7). */\n- enum logical_locations::kind kind = m_logical_loc_mgr->get_kind (k);\n+ enum logical_locations::kind kind = logical_loc_mgr->get_kind (k);\n if (const char *sarif_kind_str = maybe_get_sarif_kind (kind))\n sarif_logical_loc->set_string (\"kind\", sarif_kind_str);\n \n /* \"parentIndex\" property (SARIF v2.1.0 section 3.33.8). */\n- if (auto parent_key = m_logical_loc_mgr->get_parent (k))\n+ if (auto parent_key = logical_loc_mgr->get_parent (k))\n {\n /* Recurse upwards. */\n int parent_index = ensure_sarif_logical_location_for (parent_key);\n@@ -3105,7 +3103,8 @@ std::unique_ptr<sarif_logical_location>\n sarif_builder::\n make_minimal_sarif_logical_location (logical_locations::key logical_loc)\n {\n- gcc_assert (m_logical_loc_mgr);\n+ auto logical_loc_mgr = get_logical_location_manager ();\n+ gcc_assert (logical_loc_mgr);\n \n /* Ensure that m_cached_logical_locs has a \"logicalLocation\" object\n (SARIF v2.1.0 section 3.33) for LOGICAL_LOC, and return its index within\n@@ -3120,7 +3119,7 @@ make_minimal_sarif_logical_location (logical_locations::key logical_loc)\n \n /* \"fullyQualifiedName\" property (SARIF v2.1.0 section 3.33.5). */\n if (const char *name_with_scope\n- = m_logical_loc_mgr->get_name_with_scope (logical_loc))\n+\t= logical_loc_mgr->get_name_with_scope (logical_loc))\n sarif_logical_loc->set_string (\"fullyQualifiedName\", name_with_scope);\n \n return sarif_logical_loc;\ndiff --git a/gcc/testsuite/gcc.dg/sarif-output/ice-pr124014.c b/gcc/testsuite/gcc.dg/sarif-output/ice-pr124014.c\nnew file mode 100644\nindex 0000000000000..6a7bc5de32f4f\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/sarif-output/ice-pr124014.c\n@@ -0,0 +1,4 @@\n+/* { dg-options \"-fdiagnostics-add-output=sarif -fbranch-probabilities\" } */\n+/* { dg-additional-options \"-flto\" { target lto } } */\n+\n+void main() {} /* { dg-warning \"missing-profile\" } */\n", "prefixes": [ "pushed:", "r16-7422" ] }