{"id":2229944,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229944/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260428232728.1953812-1-dmalcolm@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","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},"msgid":"<20260428232728.1953812-1-dmalcolm@redhat.com>","date":"2026-04-28T23:27:27","name":"[pushed:,r17-171] sarif-replay: decode event IDs [PR123056]","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d2660e269266995ccbb40fb148d8ebced4566fa6","submitter":{"id":24465,"url":"http://patchwork.ozlabs.org/api/1.1/people/24465/?format=json","name":"David Malcolm","email":"dmalcolm@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260428232728.1953812-1-dmalcolm@redhat.com/mbox/","series":[{"id":501953,"url":"http://patchwork.ozlabs.org/api/1.1/series/501953/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=501953","date":"2026-04-28T23:27:27","name":"[pushed:,r17-171] sarif-replay: decode event IDs [PR123056]","version":1,"mbox":"http://patchwork.ozlabs.org/series/501953/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229944/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229944/checks/","tags":{},"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=II9isQs2;\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=II9isQs2","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\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 4g4xSd5sRKz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 09:28:17 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id BDFE14BBC0CA\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 23:28:15 +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 BFC734BBC0AE\n for <gcc-patches@gcc.gnu.org>; Tue, 28 Apr 2026 23:27:32 +0000 (GMT)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-vfl6t4F3PP2Tk5Eo5GkAWg-1; Tue,\n 28 Apr 2026 19:27:30 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 14970195608F\n for <gcc-patches@gcc.gnu.org>; Tue, 28 Apr 2026 23:27:30 +0000 (UTC)","from t14s.localdomain.com (unknown [10.22.65.168])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 8AB2619560AB; Tue, 28 Apr 2026 23:27:29 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org BDFE14BBC0CA","OpenDKIM Filter v2.11.0 sourceware.org BFC734BBC0AE"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org BFC734BBC0AE","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org BFC734BBC0AE","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777418852; cv=none;\n b=tQeRh2EsMt/EYFDCFAX0BCeZtfsrgr40twL3cbs8Nn/RLjH1BHSLUtmDSIKPKFu7EC6N8LMnZEA3qJwXVyxjHhAVZO8V4aO79u5D84S4m50xzHtEA8+ZQhqi3gWlDMs/GdID/HfFnhOF2a8kvtSmZpW/dSKBPNlpaiAXeI9UJ5o=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777418852; c=relaxed/simple;\n bh=Akd5iqlk91HSl8hS6JDY8hbApnX9l1nHXjWghrMwVx8=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=qtc+QzsVTQNz68YLQ5N5ciJ0pXShfoy2eEhWTjUmCqBC9iqqrYyg7ov49WvTa6kt9rWwv9w2MejM/7FD9/k0akcML1EnhfCPoOIt3N4tSDpg3DFDm0FOVTC0Vat0QWhHkB+9T0tT2hx5d1YGcQ3+dmIXn++tt1lpJ8NxcncEwTE=","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=1777418852;\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=1fYL4j/5/v29NDC4KqHCXInbnwnLCa2/7vemxGKO12A=;\n b=II9isQs2QRzhc9Q/GaBVIT82ho3K+9cSCbw16qkNwFuEBEyBDH7u33/9x0bszwdlr26L3K\n i1MBLJEcuQkaJhYjazVg5aAytZhWTRbctDrx4TllDN1bpKZHWTeLMAqHt+wZZZdZCvJRer\n /YRI45vjnNwL47sxenuCJVNQuOpMdAI=","X-MC-Unique":"vfl6t4F3PP2Tk5Eo5GkAWg-1","X-Mimecast-MFC-AGG-ID":"vfl6t4F3PP2Tk5Eo5GkAWg_1777418850","From":"David Malcolm <dmalcolm@redhat.com>","To":"gcc-patches@gcc.gnu.org","Cc":"David Malcolm <dmalcolm@redhat.com>","Subject":"[pushed: r17-171] sarif-replay: decode event IDs [PR123056]","Date":"Tue, 28 Apr 2026 19:27:27 -0400","Message-ID":"<20260428232728.1953812-1-dmalcolm@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"dxdFlsJTMn7hcLDDTArjSzJyA9-lhkOI7Xaa8Yy7zr4_1777418850","X-Mimecast-Originator":"redhat.com","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":"Attempt to round-trip event IDs through in execution paths\nthrough SARIF.\n\nSuccessfully bootstrapped & regrtested on powerpc64le-unknown-linux-gnu\n(albeit without ada,cobol,d, and possibly missing some optional test dependencies)\nPushed to trunk as r17-171-gd03d0681feed00.\n\ngcc/ChangeLog:\n\tPR sarif-replay/123056\n\t* libsarifreplay.cc: Include \"json-pointer-parsing.h\".\n\t(sarif_replayer::sarif_replayer): Initialize m_root_val.\n\t(sarif_replayer::m_root_val): New field.\n\t(sarif_replayer::replay_file): Store m_root_val.\n\t(sarif_replayer::append_embeddded_link): Add message_obj param.\n\tAttempt to decode intra-sarif links, turning them into event IDs.\n\t(sarif_replayer::decode_link_within_sarif): New.\n\t(sarif_replayer::make_plain_text_within_result_message): Pass\n\tmessage_obj to append_embeddded_link.\n\ngcc/testsuite/ChangeLog:\n\tPR sarif-replay/123056\n\t* sarif-replay.dg/2.1.0-invalid/3.10.3-bad-json-pointer.sarif: New\n\ttest.\n\t* sarif-replay.dg/2.1.0-valid/embedded-links-pr123056-check-sarif-roundtrip.py\n\t(test_roundtrip_of_url_in_generated_sarif): Update expected\n\tresult, to expect the URL for the event.\n\nSigned-off-by: David Malcolm <dmalcolm@redhat.com>\n---\n gcc/libsarifreplay.cc                         |  65 ++++++++-\n .../3.10.3-bad-json-pointer.sarif             | 135 ++++++++++++++++++\n ...ed-links-pr123056-check-sarif-roundtrip.py |   2 +-\n 3 files changed, 197 insertions(+), 5 deletions(-)\n create mode 100644 gcc/testsuite/sarif-replay.dg/2.1.0-invalid/3.10.3-bad-json-pointer.sarif","diff":"diff --git a/gcc/libsarifreplay.cc b/gcc/libsarifreplay.cc\nindex 9cc37fc7708..a5e1f65455c 100644\n--- a/gcc/libsarifreplay.cc\n+++ b/gcc/libsarifreplay.cc\n@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.  If not see\n #include \"libgdiagnostics++.h\"\n #include \"libgdiagnostics-private.h\"\n #include \"json-parsing.h\"\n+#include \"json-pointer-parsing.h\"\n #include \"intl.h\"\n #include \"sarif-spec-urls.def\"\n #include \"libsarifreplay.h\"\n@@ -307,6 +308,7 @@ public:\n \t\t  libgdiagnostics::manager &&control_manager)\n   : m_output_mgr (std::move (output_manager)),\n     m_control_mgr (std::move (control_manager)),\n+    m_root_val (nullptr),\n     m_driver_obj (nullptr),\n     m_artifacts_arr (nullptr)\n   {\n@@ -711,7 +713,12 @@ private:\n \n   void\n   append_embeddded_link (libgdiagnostics::message_buffer &result,\n-\t\t\t const embedded_link &link);\n+\t\t\t const embedded_link &link,\n+\t\t\t const json::object &message_obj);\n+\n+  const json::value *\n+  decode_link_within_sarif (const char *dst,\n+\t\t\t    const json::object &message_obj);\n \n   /* The manager to replay the SARIF files to.  */\n   libgdiagnostics::manager m_output_mgr;\n@@ -724,6 +731,7 @@ private:\n \n   json::simple_location_map m_json_location_map;\n \n+  const json::value *m_root_val;\n   const json::object *m_driver_obj;\n   const json::array *m_artifacts_arr;\n };\n@@ -857,6 +865,7 @@ sarif_replayer::replay_file (const char *filename,\n     }\n \n   gcc_assert (result.m_val.get ());\n+  m_root_val = result.m_val.get ();\n   return emit_sarif_as_diagnostics (*result.m_val.get ());\n }\n \n@@ -1563,11 +1572,36 @@ maybe_consume_embedded_link (const char *&iter_src)\n \n void\n sarif_replayer::append_embeddded_link (libgdiagnostics::message_buffer &result,\n-\t\t\t\t       const embedded_link &link)\n+\t\t\t\t       const embedded_link &link,\n+\t\t\t\t       const json::object &message_obj)\n {\n-  /* We can't yet decode intra-sarif links, so simply use their text.  */\n+  /* Try to convert intra-sarif links into event ids.  */\n   if (!strncmp (link.destination.c_str (), \"sarif:/\", strlen (\"sarif:/\")))\n     {\n+      if (auto linked_val = decode_link_within_sarif (link.destination.c_str (),\n+\t\t\t\t\t\t      message_obj))\n+\t{\n+\t  /* Assume we have a threadFlowLocation object, and that it's\n+\t     for the correct code flow.  */\n+\t  if (const json::object *linked_obj\n+\t\t= dyn_cast <const json::object *> (linked_val))\n+\t    {\n+\t      const property_spec_ref location_prop\n+\t\t(\"threadFlowLocation\", \"executionOrder\", \"3.38.11\");\n+\t      if (auto execution_order\n+\t\t  = get_optional_property<json::integer_number> (*linked_obj,\n+\t\t\t\t\t\t\t\t location_prop))\n+\t\tif (execution_order->get () > 0)\n+\t\t  {\n+\t\t    diagnostic_event_id event_id = execution_order->get () - 1;\n+\t\t    diagnostic_message_buffer_append_event_id (result.m_inner,\n+\t\t\t\t\t\t\t       event_id);\n+\t\t    return;\n+\t\t  }\n+\t    }\n+\t}\n+\n+      /* If we can't use the sarif link, simply use the text.  */\n       result += link.text.c_str ();\n       return;\n     }\n@@ -1576,6 +1610,29 @@ sarif_replayer::append_embeddded_link (libgdiagnostics::message_buffer &result,\n   result.end_url ();\n }\n \n+const json::value *\n+sarif_replayer::decode_link_within_sarif (const char *dst,\n+\t\t\t\t\t  const json::object &message_obj)\n+{\n+  gcc_assert (!strncmp (dst, \"sarif:/\", strlen (\"sarif:/\")));\n+  gcc_assert (m_root_val);\n+\n+  auto result\n+    = json::pointer::parse_utf8_string (dst + strlen (\"sarif:/\") - 1,\n+\t\t\t\t\tm_root_val);\n+  if (result.m_err)\n+    {\n+      const spec_ref uris_with_sarif_scheme (\"3.10.3\");\n+      pp_token_buffer_element e (result.m_err->m_tokens);\n+      report_invalid_sarif\n+\t(message_obj, uris_with_sarif_scheme,\n+\t \"error parsing JSON pointer in SARIF link %qs: %e\",\n+\t dst, &e);\n+      return nullptr;\n+    }\n+  return result.m_val;\n+}\n+\n /* Lookup the plain text string within a result.message (§3.27.11),\n    and substitute for any placeholders (§3.11.5) and handle any\n    embedded links (§3.11.6).\n@@ -1660,7 +1717,7 @@ make_plain_text_within_result_message (const json::object *tool_component_obj,\n \t    }\n \t}\n       else if (auto link = maybe_consume_embedded_link (iter_src))\n-\tappend_embeddded_link (result, *link);\n+\tappend_embeddded_link (result, *link, message_obj);\n       else\n \t{\n \t  result += ch;\ndiff --git a/gcc/testsuite/sarif-replay.dg/2.1.0-invalid/3.10.3-bad-json-pointer.sarif b/gcc/testsuite/sarif-replay.dg/2.1.0-invalid/3.10.3-bad-json-pointer.sarif\nnew file mode 100644\nindex 00000000000..206a0db0d94\n--- /dev/null\n+++ b/gcc/testsuite/sarif-replay.dg/2.1.0-invalid/3.10.3-bad-json-pointer.sarif\n@@ -0,0 +1,135 @@\n+{\"$schema\": \"https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json\",\n+ \"version\": \"2.1.0\",\n+ \"runs\": [{\"tool\": {\"driver\": {\"name\": \"GNU C23\",\n+                               \"fullName\": \"GNU C23 (GCC) version 16.0.1 20260114 (experimental) (x86_64-pc-linux-gnu)\",\n+                               \"version\": \"16.0.1 20260114 (experimental)\",\n+                               \"informationUri\": \"https://gcc.gnu.org/gcc-16/\",\n+                               \"rules\": [{\"id\": \"-Wanalyzer-malloc-leak\",\n+                                          \"helpUri\": \"https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-Wanalyzer-malloc-leak\"}]}},\n+           \"taxonomies\": [{\"name\": \"CWE\",\n+                           \"version\": \"4.7\",\n+                           \"organization\": \"MITRE\",\n+                           \"shortDescription\": {\"text\": \"The MITRE Common Weakness Enumeration\"},\n+                           \"taxa\": [{\"id\": \"401\",\n+                                     \"helpUri\": \"https://cwe.mitre.org/data/definitions/401.html\"}]}],\n+           \"invocations\": [{\"arguments\": [\"./cc1\",\n+                                          \"-quiet\",\n+                                          \"-iprefix\",\n+                                          \"/home/david/coding-3/gcc-newgit-queued-for-next-stage-1/build/gcc/../lib/gcc/x86_64-pc-linux-gnu/16.0.1/\",\n+                                          \"-isystem\",\n+                                          \"./include\",\n+                                          \"-isystem\",\n+                                          \"./include-fixed\",\n+                                          \"pr123056.c\",\n+                                          \"-quiet\",\n+                                          \"-dumpbase\",\n+                                          \"pr123056.c\",\n+                                          \"-dumpbase-ext\",\n+                                          \".c\",\n+                                          \"-mtune=generic\",\n+                                          \"-march=x86-64\",\n+                                          \"-fanalyzer\",\n+                                          \"-fdiagnostics-add-output=sarif\",\n+                                          \"-fdiagnostics-add-output=experimental-html\",\n+                                          \"-o\",\n+                                          \"pr123056.s\"],\n+                            \"workingDirectory\": {\"uri\": \"/home/david/coding-3/gcc-newgit-queued-for-next-stage-1/build/gcc\"},\n+                            \"startTimeUtc\": \"2026-01-16T17:43:19Z\",\n+                            \"executionSuccessful\": true,\n+                            \"toolExecutionNotifications\": [],\n+                            \"endTimeUtc\": \"2026-01-16T17:43:19Z\"}],\n+           \"originalUriBaseIds\": {\"PWD\": {\"uri\": \"file:///home/david/coding-3/gcc-newgit-queued-for-next-stage-1/build/gcc/\"}},\n+           \"artifacts\": [{\"location\": {\"uri\": \"pr123056.c\",\n+                                       \"uriBaseId\": \"PWD\"},\n+                          \"sourceLanguage\": \"c\",\n+                          \"contents\": {\"text\": \"void test (void)\\n{\\n  void *p = __builtin_malloc (1024);\\n}\\n\"},\n+                          \"roles\": [\"analysisTarget\",\n+                                    \"tracedFile\"]}],\n+           \"results\": [{\"ruleId\": \"-Wanalyzer-malloc-leak\",\n+                        \"taxa\": [{\"id\": \"401\",\n+                                  \"toolComponent\": {\"name\": \"cwe\"}}],\n+                        \"properties\": {\"gcc/analyzer/saved_diagnostic/sm\": \"malloc\",\n+                                       \"gcc/analyzer/saved_diagnostic/ploc\": {\"enode\": 5},\n+                                       \"gcc/analyzer/saved_diagnostic/var\": \"p_3\",\n+                                       \"gcc/analyzer/saved_diagnostic/sval\": \"&HEAP_ALLOCATED_REGION(14)\",\n+                                       \"gcc/analyzer/saved_diagnostic/state\": \"unchecked ({free})\",\n+                                       \"gcc/analyzer/saved_diagnostic/idx\": 0,\n+                                       \"gcc/analyzer/saved_diagnostic/duplicates\": [{\"properties\": {\"gcc/analyzer/saved_diagnostic/sm\": \"malloc\",\n+                                                                                                    \"gcc/analyzer/saved_diagnostic/ploc\": {\"enode\": 5},\n+                                                                                                    \"gcc/analyzer/saved_diagnostic/var\": \"p_3\",\n+                                                                                                    \"gcc/analyzer/saved_diagnostic/sval\": \"&HEAP_ALLOCATED_REGION(14)\",\n+                                                                                                    \"gcc/analyzer/saved_diagnostic/state\": \"unchecked ({free})\",\n+                                                                                                    \"gcc/analyzer/saved_diagnostic/idx\": 1,\n+                                                                                                    \"gcc/analyzer/pending_diagnostic/kind\": \"malloc_leak\"}}],\n+                                       \"gcc/analyzer/pending_diagnostic/kind\": \"malloc_leak\"},\n+                        \"level\": \"warning\",\n+                        \"message\": {\"text\": \"leak of ‘p’\"},\n+                        \"locations\": [{\"physicalLocation\": {\"artifactLocation\": {\"uri\": \"pr123056.c\",\n+                                                                                 \"uriBaseId\": \"PWD\"},\n+                                                            \"region\": {\"startLine\": 4,\n+                                                                       \"startColumn\": 1,\n+                                                                       \"endColumn\": 2},\n+                                                            \"contextRegion\": {\"startLine\": 4,\n+                                                                              \"snippet\": {\"text\": \"}\\n\"}}},\n+                                       \"logicalLocations\": [{\"index\": 0,\n+                                                             \"fullyQualifiedName\": \"test\"}]}],\n+                        \"codeFlows\": [{\"threadFlows\": [{\"id\": \"main\",\n+                                                        \"locations\": [{\"properties\": {\"gcc/analyzer/checker_event/emission_id\": \"(1)\",\n+                                                                                      \"gcc/analyzer/checker_event/kind\": \"state_change\"},\n+                                                                       \"location\": {\"physicalLocation\": {\"artifactLocation\": {\"uri\": \"pr123056.c\",\n+                                                                                                                              \"uriBaseId\": \"PWD\"},\n+                                                                                                         \"region\": {\"startLine\": 3,\n+                                                                                                                    \"startColumn\": 13,\n+                                                                                                                    \"endColumn\": 36},\n+                                                                                                         \"contextRegion\": {\"startLine\": 3,\n+                                                                                                                           \"snippet\": {\"text\": \"  void *p = __builtin_malloc (1024);\\n\"}}},\n+                                                                                    \"logicalLocations\": [{\"index\": 0,\n+                                                                                                          \"fullyQualifiedName\": \"test\"}],\n+                                                                                    \"message\": {\"text\": \"allocated here\"}},\n+                                                                       \"kinds\": [\"acquire\",\n+                                                                                 \"memory\"],\n+                                                                       \"nestingLevel\": 1,\n+                                                                       \"executionOrder\": 1},\n+                                                                      {\"properties\": {\"gcc/analyzer/checker_event/emission_id\": \"(2)\",\n+                                                                                      \"gcc/analyzer/checker_event/kind\": \"warning\"},\n+                                                                       \"location\": {\"physicalLocation\": {\"artifactLocation\": {\"uri\": \"pr123056.c\",\n+                                                                                                                              \"uriBaseId\": \"PWD\"},\n+                                                                                                         \"region\": {\"startLine\": 4,\n+                                                                                                                    \"startColumn\": 1,\n+                                                                                                                    \"endColumn\": 2},\n+                                                                                                         \"contextRegion\": {\"startLine\": 4,\n+                                                                                                                           \"snippet\": {\"text\": \"}\\n\"}}},\n+                                                                                    \"logicalLocations\": [{\"index\": 0,\n+                                                                                                          \"fullyQualifiedName\": \"test\"}],\n+                                                                                    \"message\": {\"text\": \"‘p’ leaks here; was allocated at [(1)](sarif:/runs/1066/results/0/codeFlows/0/threadFlows/0/locations/0)\"}}, // { dg-error \"array index 1066 out of range for array '/runs'\" }\n+                                                                       \"kinds\": [\"danger\"],\n+                                                                       \"nestingLevel\": 1,\n+                                                                       \"executionOrder\": 2}]}]}]}],\n+           \"logicalLocations\": [{\"name\": \"test\",\n+                                 \"fullyQualifiedName\": \"test\",\n+                                 \"decoratedName\": \"test\",\n+                                 \"kind\": \"function\",\n+                                 \"index\": 0}]}]}\n+\n+/* { dg-begin-multiline-output \"\" }\n+In JSON object '/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1/location/message':\n+   { dg-end-multiline-output \"\" } */\n+/* { dg-begin-multiline-output \"\" }\n+  104 |                                                                                     \"message\": {\"text\": \"‘p’ leaks here; was allocated at [(1)](sarif:/runs/1066/results/0/codeFlows/0/threadFlows/0/locations/0)\"}},\n+      |                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+   { dg-end-multiline-output \"\" }  */\n+/* { dg-begin-multiline-output \"\" }\n+In function 'test':\n+pr123056.c:4:1: warning: leak of ‘p’ [-Wanalyzer-malloc-leak]\n+    4 | }\n+      | ^\n+  'test': events 1-2\n+    3 |   void *p = __builtin_malloc (1024);\n+      |             ^~~~~~~~~~~~~~~~~~~~~~~\n+      |             |\n+      |             (1) allocated here\n+    4 | }\n+      | ~            \n+      | |\n+      | (2) ‘p’ leaks here; was allocated at (1)\n+   { dg-end-multiline-output \"\" }  */\ndiff --git a/gcc/testsuite/sarif-replay.dg/2.1.0-valid/embedded-links-pr123056-check-sarif-roundtrip.py b/gcc/testsuite/sarif-replay.dg/2.1.0-valid/embedded-links-pr123056-check-sarif-roundtrip.py\nindex 5e45e2a0c7f..3dfec9e9644 100644\n--- a/gcc/testsuite/sarif-replay.dg/2.1.0-valid/embedded-links-pr123056-check-sarif-roundtrip.py\n+++ b/gcc/testsuite/sarif-replay.dg/2.1.0-valid/embedded-links-pr123056-check-sarif-roundtrip.py\n@@ -11,4 +11,4 @@ def test_roundtrip_of_url_in_generated_sarif(sarif):\n     assert result['level'] == 'warning'\n     assert result['message']['text'] == \"leak of ‘p’\"\n     assert (result['codeFlows'][0]['threadFlows'][0]['locations'][1]['location']['message']['text']\n-            == \"‘p’ leaks here; was allocated at (1)\")\n+            == \"‘p’ leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)\")\n","prefixes":["pushed:","r17-171"]}