https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87975
Bug ID: 87975 Summary: Bad diagnostic context arrow emission when line contains a trigraph (-trigraphs) Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: spam at rob1nn dot pw Target Milestone: --- Created attachment 44986 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44986&action=edit test case source file showcasing the fault (build with -trigraphs) When trigraphs are part of any diagnostic output message (e.g. warning, note) and in front of the highlighted context, the highlighting and arrow of the diagnostic message context are wrongfully shifted to the left by (trigraph count) * 2 columns For example, building the attached test case with `gcc -trigraphs trigraph.c` results in: test.c: In function ‘main’: test.c:4:21: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] if(false ??!??! true) printf("warn"); ^~~~~~ test.c:4:21: warning: incompatible implicit declaration of built-in function ‘printf’ test.c:4:21: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ test.c:2:1: +#include <stdio.h> test.c:4:21: if(false ??!??! true) printf("warn"); ^~~~~~ ^ these context markers and the associated coloring are shifted 4 to the left, possibly because the two ??! trigraphs are condensed to || before the diagnostic message is generated - thereby shortening the line in front of the marker This is on gcc version 8.2.1 20180831 (GCC)