public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/114348] New: Corrupt SARIF output on stderr
@ 2024-03-15  6:59 specht.tobias at gmx dot de
  2024-03-15  7:06 ` [Bug analyzer/114348] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: specht.tobias at gmx dot de @ 2024-03-15  6:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114348

            Bug ID: 114348
           Summary: Corrupt SARIF output on stderr
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: specht.tobias at gmx dot de
  Target Milestone: ---

I noticed a situation, where the SARIF output on stderr of the `-fanalyzer` is
corrupted by a compiler error message, also written to stderr:

```
$ cat test.c
#include "test.h"
$ gcc -fanalyzer -fdiagnostics-format=sarif-stderr -c test.c
{"$schema":
"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
"version": "2.1.0", "runs": [{"tool": {"driver": {"name": "GNU C17",
"fullName": "GNU C17 (GCC) version 13.2.1 20231205 (Red Hat 13.2.1-6)
(x86_64-redhat-linux)", "version": "13.2.1 20231205 (Red Hat 13.2.1-6)",
"informationUri": "https://gcc.gnu.org/gcc-13/", "rules": []}}, "invocations":
[{"executionSuccessful": true, "toolExecutionNotifications": []}],
"originalUriBaseIds": {"PWD": {"uri": "file:///tmp"}}, "artifacts":
[{"location": {"uri": "test.c", "uriBaseId": "PWD"}, "contents": {"text":
"#include \"test.h\"\n"}, "sourceLanguage": "c"}], "results": [{"ruleId":
"fatal error", "message": {"text": "test.h: No such file or directory"},
"locations": [{"physicalLocation": {"artifactLocation": {"uri": "test.c",
"uriBaseId": "PWD"}, "region": {"startLine": 1, "startColumn": 10, "endColumn":
18}, "contextRegion": {"startLine": 1, "snippet": {"text": "#include
\"test.h\"\n"}}}}]}]}]}
compilation terminated.
```

The message `compilation terminated.` is written to stderr.

This happens when a header file is not found (also noted in the SARIF file).
Other compiler errors (e.g. missing symbol, syntax error) do not show this
problem and only generate SARIF output on stderr.
Maybe this bug is related to the preprocessor?

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-10 18:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-15  6:59 [Bug analyzer/114348] New: Corrupt SARIF output on stderr specht.tobias at gmx dot de
2024-03-15  7:06 ` [Bug analyzer/114348] " pinskia at gcc dot gnu.org
2024-03-15  7:14 ` [Bug middle-end/114348] " specht.tobias at gmx dot de
2024-03-18 22:18 ` dmalcolm at gcc dot gnu.org
2024-03-19 18:01 ` cvs-commit at gcc dot gnu.org
2024-03-19 18:07 ` dmalcolm at gcc dot gnu.org
2024-03-20  9:40 ` specht.tobias at gmx dot de
2024-05-09 17:12 ` cvs-commit at gcc dot gnu.org
2024-05-10 18:53 ` dmalcolm at gcc dot gnu.org

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).