[Bug fortran/105916] New: gfortran -fdiagnostics-format=json yields incorrect output
gnikit at duck dot com
gcc-bugzilla@gcc.gnu.org
Fri Jun 10 11:55:57 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105916
Bug ID: 105916
Summary: gfortran -fdiagnostics-format=json yields incorrect
output
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gnikit at duck dot com
Target Milestone: ---
Using the option `-fdiagnostics-format=json` with gfortran yields unexpected
and erroneous output.
Consider the trivial MWE
tmp.f90
```fortran
program main
implicit none
print*, "Hello World!"
end program main
```
One would expect when compiled the json output to be empty, but
gfortran -fdiagnostics-format=json tmp.f90
results to (formatted to be human readable)
```json
[
{
"kind": "error",
"column-origin": 1,
"children": [
{
"kind": "error",
"escape-source": false,
"locations": [
{
"caret": {
"byte-column": 13,
"display-column": 13,
"line": 2,
"file": "tmp.f90",
"column": 13
}
}
],
"message": "Function ‘implicit’ requires an argument list at (1)"
},
{
"kind": "error",
"escape-source": false,
"locations": [
{
"caret": {
"byte-column": 13,
"display-column": 13,
"line": 2,
"file": "tmp.f90",
"column": 13
}
}
],
"message": "Syntax error in IMPLICIT statement at (1)"
},
{
"kind": "error",
"escape-source": false,
"locations": [
{
"caret": {
"byte-column": 10,
"display-column": 10,
"line": 3,
"file": "tmp.f90",
"column": 10
}
}
],
"message": "Function ‘print’ requires an argument list at (1)"
},
{
"kind": "error",
"escape-source": false,
"locations": [
{
"caret": {
"byte-column": 4,
"display-column": 4,
"line": 4,
"file": "tmp.f90",
"column": 4
}
}
],
"message": "Function ‘end’ requires an argument list at (1)"
}
],
"escape-source": false,
"locations": [
{
"caret": {
"byte-column": 8,
"display-column": 8,
"line": 1,
"file": "tmp.f90",
"column": 8
}
}
],
"message": "Function ‘program’ requires an argument list at (1)"
}
]
```
More information about the Gcc-bugs
mailing list