public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3469] diagnostics: fix ICE in sarif output with NULL filename [PR107366] Date: Mon, 24 Oct 2022 20:49:18 +0000 (GMT) [thread overview] Message-ID: <20221024204918.C100A3857C52@sourceware.org> (raw) https://gcc.gnu.org/g:2e8a0553918adc919f98ac5c0224fc6ce1fef68d commit r13-3469-g2e8a0553918adc919f98ac5c0224fc6ce1fef68d Author: Martin Liska <mliska@suse.cz> Date: Mon Oct 24 16:40:00 2022 -0400 diagnostics: fix ICE in sarif output with NULL filename [PR107366] gcc/ChangeLog: PR analyzer/107366 * diagnostic-format-sarif.cc (sarif_builder::maybe_make_physical_location_object): Gracefully reject locations with NULL filename. gcc/testsuite/ChangeLog: PR analyzer/107366 * gcc.dg/analyzer/sarif-pr107366.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com> Diff: --- gcc/diagnostic-format-sarif.cc | 2 +- gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc index fc28d160c38..7110db4edd6 100644 --- a/gcc/diagnostic-format-sarif.cc +++ b/gcc/diagnostic-format-sarif.cc @@ -595,7 +595,7 @@ sarif_builder::make_location_object (const diagnostic_event &event) json::object * sarif_builder::maybe_make_physical_location_object (location_t loc) { - if (loc <= BUILTINS_LOCATION) + if (loc <= BUILTINS_LOCATION || LOCATION_FILE (loc) == NULL) return NULL; json::object *phys_loc_obj = new json::object (); diff --git a/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c b/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c new file mode 100644 index 00000000000..997cf56586d --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fdiagnostics-format=sarif-file" } */ + +typedef enum { + HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO +} hwloc_topology_diff_obj_attr_type_t; +enum { HWLOC_TOPOLOGY_DIFF_OBJ_ATTR } hwloc_apply_diff_one_diff_0_0; + +void +hwloc_apply_diff_one() { + switch (hwloc_apply_diff_one_diff_0_0) + case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR: { + hwloc_topology_diff_obj_attr_type_t obj_attr_2_0_0; + switch (obj_attr_2_0_0) + case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO: { + unsigned ii = 0; + } + } +} +
reply other threads:[~2022-10-24 20:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221024204918.C100A3857C52@sourceware.org \ --to=dmalcolm@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).