[Bug c/121566] New: Caret shown at wrong position when trigraphs are used
jepler at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 15 16:12:52 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121566
Bug ID: 121566
Summary: Caret shown at wrong position when trigraphs are used
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jepler at gmail dot com
Target Milestone: ---
Compiling the following code with `gcc -trigraphs`
> int main() {
> return ??-??-??-??-??-??-??---1;
> }
produces a diagnostic in which the caret is shown at the wrong location:
> <source>: In function 'main':
> <source>:2:19: error: lvalue required as decrement operand
> 2 | return ??-??-??-??-??-??-??---1;
> | ^~
It appears that the horizontal position tracking does not correctly account for
the number of columns that trigraphs occupy.
godbolt: https://godbolt.org/z/Eehn6Pjao
More information about the Gcc-bugs
mailing list