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

            Bug ID: 125773
           Summary: -fdiagnostics-format=sarif-stderr counts TAB as 8
                    columns, when it should be 1
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: diagnostics
          Assignee: dmalcolm at redhat dot com
          Reporter: lahvuun at gmail dot com
  Target Milestone: ---

Example code (there is a TAB before foo):
```
        foo(void);
```

Output of ./gcc -c foo.c -fdiagnostics-format=sarif-stderr (shortened to the
relevant part):
```
"region":{"startLine":1,"startColumn":9,"endColumn":12}
```

I think startColumn should be 2 here, not 9. I'm far from an expert on SARIF,
but the way I understand it, SARIF producers are supposed to measure columns in
either UTF-16 code units or Unicode code points. See "3.14.27 columnKind
property" in the spec:
https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html

TAB is 1 code unit in UTF-16 and 1 code point in Unicode, so GCC should count
it as 1 column either way, not 8. Clang with -fdiagnostics-format=sarif already
counts it as 1.

Reply via email to