https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126224
Bug ID: 126224
Summary: No output when -fmax-errors exceeded if using
-fdiagnostics-format
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jvalcher at gmail dot com
Target Milestone: ---
If n exceeds `-fmax-errors=n` while using `-fdiagnostics-format` then there is
no output. If n <= `-fmax-errors` there is no issue. For example, if I build
the following...
int main() {
d = 1;
e = 2;
}
$ gcc -fdiagnostics-format=sarif-stderr -fmax-errors=1 prog.c
... there will be no output. But if I remove an error which falls within the
setting...
int main() {
d = 1;
}
There will be output. The expected behavior here is that it prints out n or
less formatted errors. This appears to be the case no matter what
`-fmax-errors` is set to. For example, instead of printing out the first three
errors in the following build, there is no output.
int main() {
d = 1;
e = 2;
f = 2;
g = 2;
}
$ gcc -fdiagnostics-format=sarif-stderr -fmax-errors=3 prog.c
But if I remove one of the errors to bring the total to three it works just
fine.
If it helps, warnings (not effected by the `-fmax-errors` flag) are also not
displayed.
int main() {
e = 2;
f = 2;
x();
}
$ gcc -fdiagnostics-format=sarif-stderr -fmax-errors=1 prog.c
I tried this on the most recent version I could find (gcc (GCC) 17.0.0 20260703
(experimental)), and I experienced the same thing I initially did with my
Ubuntu's version (13.3.0).
My system...
Linux 6.17.0-35-generic #35~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26
19:30:42 UTC 2 x86_64 x86_64 x86_64 GNU/Linux