https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107366
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- Potential fix: 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 ();