https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77572
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Dominic Plunkett <[email protected]>: https://gcc.gnu.org/g:b13c099207e6e7c5350fc82a696bcffc23ef5a52 commit r17-7079-gb13c099207e6e7c5350fc82a696bcffc23ef5a52 Author: Dominic P <[email protected]> Date: Mon Nov 30 23:57:26 2026 +0000 c-family: Print non-ASCII chars in constants as three-digit escapes [PR77572] pp_c_char gets a negative value for bytes above 0x7f: from a char constant when char is signed, and from a string literal when the host's char is signed. It cast that to unsigned before printing it with "\\%03o", so char constants and string literals in diagnostics showed such bytes as \37777777724: the C++ diagnostic for A<'\324'> showed A<'\37777777724'>, and that for the template argument "t\324" showed "t\37777777724". The same text is used for the DW_AT_name of a template instance such as C<'\310'>. Cast to unsigned char instead. The escape stays octal, as before; the switch to hex that the PR also suggests would be a separate change. Assisted-by: Claude Opus 5.5 (Anthropic) Signed-off-by: Dominic P <[email protected]> gcc/c-family/ChangeLog: PR c++/77572 * c-pretty-print.cc (pp_c_char): Print the octal escape of an unsigned char. gcc/testsuite/ChangeLog: PR c++/77572 * g++.dg/diagnostic/pr77572.C: New test.
