Cover Letter Detail
Show a cover letter.
GET /api/covers/2196535/?format=api
{ "id": 2196535, "url": "http://patchwork.ozlabs.org/api/covers/2196535/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/cover/20260214155201.1049644-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": "<20260214155201.1049644-1-dmalcolm@redhat.com>", "list_archive_url": null, "date": "2026-02-14T15:51:56", "name": "[0/5] Improve diagnostics for bad JSON inputs [PR124094]", "submitter": { "id": 24465, "url": "http://patchwork.ozlabs.org/api/people/24465/?format=api", "name": "David Malcolm", "email": "dmalcolm@redhat.com" }, "mbox": "http://patchwork.ozlabs.org/project/gcc/cover/20260214155201.1049644-1-dmalcolm@redhat.com/mbox/", "series": [ { "id": 492183, "url": "http://patchwork.ozlabs.org/api/series/492183/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=492183", "date": "2026-02-14T15:51:56", "name": "Improve diagnostics for bad JSON inputs [PR124094]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492183/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/covers/2196535/comments/", "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=IkeC2kl9;\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=IkeC2kl9", "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 [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 4fCtq33dgXz1xwj\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 15 Feb 2026 02:53:02 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id E8AA44BAD15E\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 15:52:59 +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 0B4D74B9DB5B\n for <gcc-patches@gcc.gnu.org>; Sat, 14 Feb 2026 15:52:15 +0000 (GMT)", "from mx-prod-mc-03.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-619-Rv-7FeG4N52ayUL07okWKQ-1; Sat,\n 14 Feb 2026 10:52:11 -0500", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 0D2001956052; Sat, 14 Feb 2026 15:52:09 +0000 (UTC)", "from t14s.localdomain.com (unknown [10.22.88.22])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 0DB391955D85; Sat, 14 Feb 2026 15:52:04 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org E8AA44BAD15E", "OpenDKIM Filter v2.11.0 sourceware.org 0B4D74B9DB5B" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 0B4D74B9DB5B", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 0B4D74B9DB5B", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771084335; cv=none;\n b=TPUg3wBNUMW/c6IAsZaNLBN24iP+0DdQRrpgfU+zSTBOiGGaq6EgtvHkb6P/rftFJ1XYHJ2mJ3zJbRJW9ZwDpmc9lIzPuiZWFbewshVP99ZE6tS+vV12skWlCtZ9agMcblCwOwwSV/9T0zfOIFFm8RmkphuCToHbIUUDwVj958Q=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1771084335; c=relaxed/simple;\n bh=BUR/2XJmQ69plK+Pz0lEYiqtM5+NLUPbaoG5j50ad+0=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=G4wSIgFzhBRYEBi4vXzV80+aX+Ob/hJtVlvP1vh5R3K9iD1ffWP2Ys0htzCotPOf7InAmGaFPffdYLDMVoPkGwWe8mDMrd+ihHAeLNu6IofygJXbRLE87dbLxr0VHixpnrSa9jUCdVZGpi7XPjERV2f71ze1SehXNTnZ5ivb1wQ=", "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=1771084334;\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 in-reply-to:in-reply-to:references:references;\n bh=64e8E8YQM+9hPpUXfoYn43l3sNd9TXzZqYYLzrfr6UU=;\n b=IkeC2kl9rt733l9uKlcwzuGBHYa8HL7JA5Pp7uPRXqxqJt/9sqqoq6LNY6jmJV2SUryoK4\n F1yVT2SJwl76uRo9/WlL3nlGu827tPjuKAbbOBMuSa6acxsaJiWytI5JwWPfNOgav695YR\n OB37LoddGFvQ9zAI9f81fLlJ0zH0urc=", "X-MC-Unique": "Rv-7FeG4N52ayUL07okWKQ-1", "X-Mimecast-MFC-AGG-ID": "Rv-7FeG4N52ayUL07okWKQ_1771084329", "From": "David Malcolm <dmalcolm@redhat.com>", "To": "gcc-patches@gcc.gnu.org, Yangyu Chen <cyy@cyyself.name>,\n Soumya AR <soumyaa@nvidia.com>, jakub@redhat.com,\n Richard Biener <richard.guenther@gmail.com>", "Cc": "Alfie Richards <alfie.richards@arm.com>,\n Sandra Loosemore <sloosemore@baylibre.com>,\n Martin Liska <martin.liska@hey.com>,\n Evgeny Stupachenko <evstupac@gmail.com>,\n Alice Carlotti <alice.carlotti@arm.com>,\n Jeff Law <jeffrey.law@oss.qualcomm.com>,\n Jerry DeLisle <jvdelisle@gcc.gnu.org>, Harald Anlauf <anlauf@gmx.de>,\n Paul Thomas <pault@gcc.gnu.org>,\n Richard Sandiford <rdsandiford@googlemail.com>,\n Joseph Myers <josmyers@redhat.com>, Jason Merrill <jason@redhat.com>,\n David Malcolm <dmalcolm@redhat.com>", "Subject": "[PATCH 0/5] Improve diagnostics for bad JSON inputs [PR124094]", "Date": "Sat, 14 Feb 2026 10:51:56 -0500", "Message-ID": "<20260214155201.1049644-1-dmalcolm@redhat.com>", "In-Reply-To": "<tencent_048DF6A8630E2E590C79C840A31F1FA86006@qq.com>", "References": "<tencent_048DF6A8630E2E590C79C840A31F1FA86006@qq.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "16r4Atm_W41ZR7QuVX13swIIhUojDMgTNboinTMU2ow_1771084329", "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": "I added JSON parsing code in GCC 15 to support sarif-replay.\n\nIn GCC 16 the aarch64 target has gained the ability to load tuning\ninformation in JSON form via -muser-provided-CPU=FILENAME.json (see\nr16-5615-g59f37983222d86 through r16-5619-ga0b8cc4a473e1e).\n\nThe UX is currently rather poor for malformed and invalid inputs to\n-muser-provided-CPU=:\n\n$ ./xgcc -B. -S test.c -muser-provided-CPU=malformed.json\ncc1: error: error parsing JSON data: expected ':'; got number\n\n$ ./xgcc -B. -S test.c -muser-provided-CPU=unsigned-3.json\ncc1: warning: JSON tuning file does not contain version information; compatibility cannot be verified\ncc1: error: key ‘tune_params.sve_width’ value 5000000000 is out of range for ‘uint’ type [0, 4294967295]\ncc1: error: validation failed for the provided JSON data\n\nIn particular it doesn't show location information within the JSON file.\n\nA further JSON input to GCC is being considered via patch\n \"fmv: Add -ftarget-clones-table option support\"\n https://gcc.gnu.org/pipermail/gcc-patches/2026-February/708264.html\nand that patch has similar issues with the diagnostics it emits on bad\ninput JSON.\n\nThis patch kit:\n* moves some support code out from libgdiagnostics and sarif-replay so\n that it can be used with global_dc,\n* uses that to introduce a new json-diagnostic.{cc,h} to make it easy to\n emit JSON diagnostics with location information from within GCC\n* updates aarch64's -muser-provided-CPU= implementation to improve the\n error handling.\n\nWith this patch, the above is improved to:\n\n$ ./xgcc -B. -S test.c -muser-provided-CPU=malformed.json\nmalformed.json:3:17: error: error parsing JSON data: expected ':'; got number\n 3 | \"sve_width\" 128\n | ^~~\n\n$ ./xgcc -B. -S test.c -muser-provided-CPU=unsigned-3.json\ncc1: warning: JSON tuning file does not contain version information; compatibility cannot be verified\nunsigned-3.json: In JSON value ‘/tune_params/sve_width’\nunsigned-3.json:3:18: error: key ‘tune_params.sve_width’ value 5000000000 is out of range for ‘uint’ type [0, 4294967295]\n 3 | \"sve_width\": 5000000000\n | ^~~~~~~~~~\ncc1: error: validation failed for the provided JSON data\n\nshowing file:line:column of the problematic JSON, quoting and\nunderlining the pertinent part of the input, and showing the\nJSON Pointer of the relevant value, if there is one. This data is also\nnow captured by SARIF and HTML diagnostic sinks.\n\nA similar approach could be adopted for the -ftarget-clones-table\npatch to improve its diagnostics for bad input JSON.\n\nThe option -muser-provided-CPU= is new in GCC 16, but apparently is\nintended purely for GCC developers. I'm not sure whether the fmv json\npatch is aimed at GCC 16 or GCC 17, but it appears to be aimed at\nend-users.\n\nI'd like to push this to trunk now, but I appreciate that it's\nnon-trivial and not technically a fix of a regression, but it does add\nUX polish.\n\nI can self-approve the diagnostics/json refactorings.\n\naarch64 maintainers: are the aarch64 changes OK for trunk, either in\nstage 4 or next stage 1?\n\nRelease managers: is this OK for stage 4, or should this wait until next\nstage 1?\n\nThanks\nDave\n\nDavid Malcolm (5):\n diagnostics: use label_text for logical_location strings\n diagnostics: split out physical_location_maker from libgdiagnostics\n json: split out replayer_location_map from libsarifreplay.cc\n Add json-diagnostic.{cc,h}\n aarch64: improve diagnostics for bogus JSON tuning inputs [PR124094]\n\n gcc/Makefile.in | 3 +-\n .../aarch64-generate-json-tuning-routines.py | 17 +-\n .../aarch64-json-tunings-parser-generated.inc | 428 +++++++++---------\n .../aarch64/aarch64-json-tunings-parser.cc | 279 ++++++++----\n gcc/diagnostics/client-data-hooks.h | 53 +++\n gcc/diagnostics/context.cc | 5 +-\n gcc/diagnostics/context.h | 4 +-\n gcc/diagnostics/html-sink.cc | 11 +-\n gcc/diagnostics/logical-locations.h | 6 +-\n gcc/diagnostics/physical-location-maker.cc | 75 +++\n gcc/diagnostics/physical-location-maker.h | 60 +++\n gcc/diagnostics/sarif-sink.cc | 24 +-\n gcc/diagnostics/selftest-logical-locations.cc | 18 +-\n gcc/diagnostics/selftest-logical-locations.h | 6 +-\n gcc/diagnostics/state-graphs-to-dot.cc | 15 +-\n gcc/json-diagnostic.cc | 374 +++++++++++++++\n gcc/json-diagnostic.h | 74 +++\n gcc/json-parsing.cc | 1 +\n gcc/json-parsing.h | 24 +\n gcc/libgdiagnostics.cc | 62 +--\n gcc/libsarifreplay.cc | 23 +-\n .../aarch64/aarch64-json-tunings/boolean-2.c | 12 +-\n .../aarch64-json-tunings/empty-brackets.c | 9 +-\n .../aarch64/aarch64-json-tunings/enum-2.c | 19 +-\n .../aarch64/aarch64-json-tunings/integer-2.c | 14 +-\n .../aarch64/aarch64-json-tunings/integer-3.c | 13 +-\n .../aarch64/aarch64-json-tunings/malformed.c | 11 +\n .../aarch64-json-tunings/malformed.json | 5 +\n .../aarch64/aarch64-json-tunings/string-2.c | 12 +-\n .../aarch64-json-tunings/unidentified-key.c | 12 +-\n .../aarch64/aarch64-json-tunings/unsigned-2.c | 10 +-\n .../aarch64/aarch64-json-tunings/unsigned-3.c | 10 +-\n gcc/tree-logical-location.cc | 26 +-\n gcc/tree-logical-location.h | 6 +-\n 34 files changed, 1275 insertions(+), 446 deletions(-)\n create mode 100644 gcc/diagnostics/physical-location-maker.cc\n create mode 100644 gcc/diagnostics/physical-location-maker.h\n create mode 100644 gcc/json-diagnostic.cc\n create mode 100644 gcc/json-diagnostic.h\n create mode 100644 gcc/testsuite/gcc.target/aarch64/aarch64-json-tunings/malformed.c\n create mode 100644 gcc/testsuite/gcc.target/aarch64/aarch64-json-tunings/malformed.json" }