diagnostics: fix ICE in sarif output with NULL filename [PR107366]
authorMartin Liska <mliska@suse.cz>
Mon, 24 Oct 2022 20:40:00 +0000 (16:40 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 24 Oct 2022 20:40:48 +0000 (16:40 -0400)
commit2e8a0553918adc919f98ac5c0224fc6ce1fef68d
tree14ccc8ffe33c3b890a8b1b31d16d25184096dc8d
parent18faaeb3af42f3d7dc609b9b91df77d0d59b16f6
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>
gcc/diagnostic-format-sarif.cc
gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c [new file with mode: 0644]